Markdown to html on the terminal

terminalIf you are well-versed in markdown, you don’t need a fully-blown editor with preview to write in markdown. For example, I am writing this article using vim. However, to post the article I need to convert it to html. Many web based markdown editors support that. Today I came across an easy to use python module which does the same.

I’ll be using Python3 to demonstrate this. While the module markdown intends to be a library, it can be run as a script.


To install the module on Ubuntu, run:

$ sudo apt-get install python3-markdown


By default the output is printed on the terminal.

To convert a markdown file to html, run:

$ python3 -m markdown

You can redirect the output to a html file as well:

$ python3 -m markdown > output.html

Get more help:

$ python3 -m markdown help

2 thoughts on “Markdown to html on the terminal”

Leave a Reply

Your email address will not be published. Required fields are marked *