ClosedGL's Website / Blog / Now Writing in Markdown

Now writing in Markdown

First published Jan 16, 2022 at 2:02 PM


Update on February 9, 2022: Oh pandoc exists?


Last month, I had the idea to write my website in Markdown instead of HTML so I could write pages in a simple text format and not have to manually write so many HTML tags. Then, when I want to upload the site, I will run a script to convert all the Markdown to HTML for web browsers.

I have now reformatted my entire site in Markdown, and I was crazy enough to write my own Markdown to HTML converter in C.

Why I made my own Markdown converter

There are web frameworks like blogit and werc that use Markdown, but I didn't want to structure my site around such a thing or configure a server for it.

I wanted something that converts Markdown files individually that I could easily throw into a build script.

I did search for a Markdown CLI program to use, but a lot of what I found either wasn't as good or was written in a cuck programming language like NodeJS or Go.

markdown-cli test

Showcasing my Markdown to HTML converter

mdbuilder help

Input Markdown files are specified with the -i option.

mdbuilder converting example markdown file

Prettyprinting is optional with the -p option.

mdbuilder without prettyprinting

mdbuilder can also only output the text in the first heading with the -t option. This can be used as a document's title.

mdbuilder only outputting 'heading 1'

If no input file is specified, mdbuilder will read from stdin.

mdbuilder reading from stdin