Markdown
Markdown is a free and open source command line application that can convert Markdown files to HTML files. It is a command line utility developed by creators of the Markdown syntax itself. To install it in Ubuntu, use the command below:
You can install Markdown command line tool in other Linux distributions from the package manager. You can also compile it from its source code available here.
To convert a “.md” file to “.html” file, run a command in the following format:
The first argument is the input “.md” file that you want to convert to a “.html” file. The second argument is the name of the “.html” output file. Replace these names as needed.
For more information on the “markdown” command, run the command below:
Pandoc
Pandoc is a free and open source document conversion utility that can convert documents written in markup languages into a number of different file formats. It supports conversion into numerous file formats, more than any other command line tool that is capable of doing document conversion. Besides converting to “.html” format, it can convert files to “.odt”, “.docx”, “.pdf”, and “.csv” formats as well. It can even convert Markdown files to “.epub” file format allowing you to read content on ereaders.
To install Pandoc in Ubuntu, use the command below:
You can install Pandoc in other Linux distributions from the package manager. More packages and installation instructions are available here.
To convert a “.md” file to a “.html” file using Pandoc, run a command in the following format:
Replace “file.md” with the name of the input file. The “-f” switch is used to specify the format of the input file. The “-t” switch can be used to specify the format of the output file. The “-s” is required to properly construct the output file. The “-o” switch can be used to provide a name for the output file.
To convert a “.md” file to a “.docx” file, run a command in the following format:
For more information on Pandoc, run the following two commands:
$ man pandoc
Kramdown
Kramdown is a free and open source Markdown converter written in Ruby programming language. It is mainly designed to convert Markdown files to HTML files. However, you can use it to convert Markdown files to kramdown, LaTeX and PDF file formats as well.
You can install Kramdown in Ubuntu using the command specified below:
You can install Kramdown in other Linux distributions from the package manager. Further installation instructions are available here.
To convert a “.md” file to a “.html” file using Kramdown, run a command in the following format:
Replace “file.md” to change input file name. The “-i” switch takes a name for input file format while the “-o” switch can be used to specify the format for the converted output. Replace “file.html” with your desired name for the output file.
For more information on Kramdown, run the following two commands:
$ man kramdown
Cmark
Cmark or CommonMark is a free and open source Markdown parser and converter written in C programming language. It claims to be much faster than other Markdown parsing apps available on the Web. It also provides a modified version of Markdown syntax, aimed to make it easier to write rich text content.
You can install Cmark in Ubuntu using the command specified below:
You can install Cmark in other Linux distributions from the package manager. Further installation instructions are available here.
To convert a “.md” file to a “.html” file using Cmark, run a command in the following format:
Replace “file.md” to change input file name. The “-t” switch is used to specify the output file format. Replace “file.html” with your desired name for the output file. You can convert “.md” files to xml, html, commonmark, latex, and man (manpage) formats using Cmark.
For more information on Cmark, run the following two command:
$ cmark --help
Grip
Grip is a free and open source Markdown file renderer and previewer written in Python. It is mainly designed to preview GitHub compatible “README.md” files. But you can use it to convert other Markdown files to HTML file format as well.
You can install Grip in Ubuntu using the command specified below:
You can install Grip in other Linux distributions from the package manager. Further installation instructions are available here.
To convert a “.md” file to a “.html” file using Grip, run a command in the following format:
Replace “file.md” to change input file name. Replace “file.html” with your desired name for the output file. Make sure that the output file name ends with “.html” extension to convert the file properly without errors.
For more information on Grip, run the following two commands:
$ man grip
Conclusion
These are some of the best command line applications that can be used to convert Markdown files to a variety of useful file formats. These tools are especially useful for those users who write content using Markdown syntax but publish it in a different markup language or in a different file format.