Markdown to HTML compiler written in Elixir with custom <script> and <div> tag formatting.
I'd been using a different markdown compiler hgen for a while, but it had problems expanding itself to the full potential of markdown.
It could compile simple markdown files, but would struggle to format more complex markdown files.
To solve this issue, I used this opportunity to learn Elixir by utilizing the Earmark package. Earmark is written in two stages. The first stage parses the markdown into an Abstract Syntax Tree (AST), and the second stage converts the AST into HTML. This one dependency greatly simplifies the compiling process, as I can write my own transformations over the already-created AST. Then, I can take the modified AST and compile it to HTML, all using Earmark's builtin functions.
js code blocks become embedded as <script> tags javascript code blocks stay as both code blocks and script tags ::<name> becomes a div tag with id=<name> <a> tags, if css or js will directly add the css/js code For fun, here's the code I use to update every page's title at the bottom of each markdown file:
document.title = "Projects - Exgen";