Skip to content

OlhaMish/markdown-ansi-parser

Repository files navigation

Markdown Parser

This console application parse markdown into html. The output can either be displayed in the console or saved to a file.

How to set up it?

Clone this repo:

 git clone https://github.com/OlhaMish/software-development-lab-1 

Then install poetry following official instruction

Run application:

poetry run python markdown2html.py <path/to/your/input/file> 

Explore commands:

poetry run python markdown2html.py --help
usage: markdown2html.py [-h] [--output OUTPUT] input_file

Convert Markdown to HTML.

positional arguments:
  input_file            Path to the input Markdown file

options:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        Path to the output HTML file
  -format, -f
                        choices: ['ansi', 'html']

Run tests

To run tests you need to install poetry, then run tests by:

  poetry run pytest

Example

Alice's Adventures in Wonderland by Lewis Carroll


This novel follows the story of a young girl named _Alice_ who falls down a rabbit hole into a **fantastical world full of peculiar creatures** and bizarre experiences. 
As she navigates through this `strange land`, she encounters a series of nonsensical events, including a tea party with a _Mad Hatter_, a pool of tears, and a trial over stolen tarts. 

```The book is renowned for its playful use of language, logic, and its **exploration** of the boundaries of reality.```

Parse it as html:

poetry run python markdown2html.py input.md -o output.html 

output.html:

<p>Alice's Adventures in Wonderland by Lewis Carroll</p>
<p> This novel follows the story of a young girl named <i>Alice</i> who falls down a rabbit hole into a <b>fantastical world full of peculiar creatures</b> and bizarre experiences. 
As she navigates through this <tt>strange land</tt>, she encounters a series of nonsensical events, including a tea party with a <i>Mad Hatter</i>, a pool of tears, and a trial over stolen tarts.</p>
<p><pre>The book is renowned for its playful use of language, logic, and its **exploration** of the boundaries of reality.</pre></p>

Parse it as ansi:

poetry run python markdown2html.py -o output.html -f ansi input.md 

output.ansi:

image

Revert commit

link

Dropped tests

link

Conclusions

From my experience, writing unit tests before coding might not seem appealing, but doing so can save considerable time.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages