How to convert Markdown files to HTML using terminal on Ubuntu 22.04

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to convert Markdown files to HTML using terminal on an Ubuntu 22.04 system The procedure is simple, let’s go for it.

Markdown is a lightweight markup language that tries to achieve maximum readability and ease of publishing in both its input and output form, drawing inspiration from many existing conventions for marking up email messages using plain text.

One of the main advantages of Markdown is that formatted text can be written quickly thanks to a syntax that is easy to learn and use.

The first implementation of Markdown was with Perl, but it has been implemented by many languages and blogging platforms that have plugins that interpret it to HTML.

In short, writing in Markdown is simple, fast, and compatible with current technologies. But occasionally, it is convenient to convert it to HTML for different needs.

Convert Markdown to HTML on Ubuntu 22.04

Within the official repositories of Ubuntu 22.04 there is a package called markdown that presents some utilities to process this type of file.

To be a bit more extensive, Markdown (the package, not the format) is a text-to-HTML filter; it translates an easy-to-read easy-to-write structured text format into HTML. Markdown’s text format is most similar to that of plain text email, and supports features such as headers, emphasis, code blocks, blockquotes, and links.

Fortunately, it is quite lightweight and doesn’t consume too many resources, so installing it is a snap.

First, open a terminal and update the system

sudo apt update
sudo apt upgrade

Then, you can search for the package in the official repositories.

sudo apt show markdown

You will get an on-screen output like this

Convert markdown to HTML using the package markdown
Convert markdown to HTML using the package markdown

Then proceed to install it

sudo apt install markdown

The next step is then to use it

The conversion process

Now it only remains to do the conversion procedure. To achieve this, you can follow this syntax.

markdown [md-file] > [out.html]

Yes, it’s that simple.

So for an example I have, I used this command

markdown sample.md > sample.html

And it already did the conversion. So, you know how to do it.

Conclusion

Markdown plays an important role nowadays. This makes it very complete and easy to learn. However, it is also convenient to know how to do HTML conversions for various purposes. Therefore, now you know.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook