Show HN: Learning Rust by writing a Markdown to HTML compiler

Jul 29, 2026 08:04 AM - 1 hour ago 3

Hi, this is Andrea.

I'm caller to Rust and thought that a very pratical measurement to get in touch pinch it was penning something. I've thought of penning my own .md to .html compiler for for a while. So present we are, both my micro-blog and my task person travel to life. Before moreover reasoning of writing it, I was utilizing Hugo. It was really nice, but you know, sometimes it's conscionable excessively much, I just wanted a very elemental thing, not taking a life choosing a taxable and other stuff, or possibly arsenic a SWE I thought I could conscionable build it myself, and after 12-13 hours of my not really spare clip I came yet pinch something.

It's very basic, written pinch nary GenAI tools, and arsenic overmuch docs arsenic possible. I've implemented very basal .md syntax for now, yet will grow later. Some clip agone I publication the dragon book, so penning a compiler was not a wholly caller thing, but it was nosy to spot that immoderate of my ain choices were pretty similar to existent .md to .html compilers, moreover Hugo itself.

The compilation follows the pursuing steps:

  • scan `post/` dir
  • for each record scan for blocks elements
  • for each artifact scan for inline elements
  • we past extremity up pinch an intermediate practice (building ASTs is ever beautiful cool):
[ Heading { level: H1, content: [ Text( "this\n", ), ], }, Heading { level: H2, content: [ Text( "is\n", ), ], }, Paragraph( [ Text( "a very ", ), Italic( "simple", ), Text( " ", ), Bold( "post", ), Text( "\n", ), ], ), ]
  • output arsenic `.html` pinch templates (very basic)

Output to record was peculiarly elemental since redefining Display on Block => Inline made it nary different than a elemental display.

Here's a demo of the generated scale and a mates posts.

demo

Let's now delve into immoderate much technicalities: Every station starts pinch a YAML beforehand matter artifact delimited by ---:

--- title: Building a markdown compiler date: 2026-07-27 description: A short statement shown successful the index tags: [rust, web] draft: false --- [markdown body]

title and day are required, the remainder are optional. day is YYYY-MM-DD and drives the ordering of the index. Setting draft: existent skips the post entirely. This is the database of the existent CommonMark coverage:

  • headings: `#` done `######`
  • paragraphs: blocks of matter separated by an quiet line
  • codeblocks: ``` aliases ~~~
  • ordered lists: `- [text]`
  • unordered list: `n) [text]` aliases `n. [text]`
  • blockquotes: `> quote`
  • inline code: `code`
  • inline strikethrough: ~text~
  • inline bold: **text**
  • inline italic: *text*
  • links: [text](url)
  • images: ![alt](url), images url mention to `static/` dir.

The index.html is the full station list, nary pagination and nary customer side router, filtering tin beryllium done done the searhc barroom connected apical of the page, (shortcut to searchbar is / and hunt matter tin beryllium deleted pinch esc), or the tags connected the azygous posts aliases still connected apical of page. You tin navigate done posts and wrong posts pinch vim-like-moves (this is vibe-coded and taxable dependent, hence I won't support way of it try it, it's beautiful cool, you tin besides yank matter :) ). Don't deliberation this tool will ever beryllium useful for anyone too me, but it was nosy to make and surely will expand, the codification tin beryllium recovered at this repo.

More