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.

Installation

To install the module on Ubuntu, run:

$ sudo apt-get install python3-markdown

Usage

By default the output is printed on the terminal.

To convert a markdown file to html, run:

$ python3 -m markdown input.md

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

$ python3 -m markdown input.md > output.html

Get more help:

$ python3 -m markdown help

2 thoughts on “Markdown to html on the terminal”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s