HeadlinesBriefing favicon HeadlinesBriefing.com

Learning Rust: Markdown to HTML Compiler

Hacker News •
×

Hi, this is Andrea. I'm new to Rust and decided to write a Markdown to HTML compiler for my micro-blog after completing half of *The Rust Programming Language*. The project is intentionally small and contained in a single file to keep the full picture in mind. It took 12-13 hours to build without any Gen AI tools, and I previously used Hugo but found it too complex for my needs.

The compilation pipeline scans the `post/` directory, processes block elements, then inline elements, building an intermediate AST before rendering HTML with basic templates. Each post starts with a YAML front matter block requiring title and date, with optional description, tags, and draft status. The compiler currently covers Common Mark syntax including headings, paragraphs, code blocks, lists, blockquotes, and inline formatting.

The generated index.html includes a search bar with keyboard shortcuts, tag filtering, and vim-like navigation for browsing posts. It's early stage—blocks must be separated by empty lines, and tests are minimal. The code is available on GitHub. While built primarily for learning, the project demonstrates practical compiler concepts and serves as a functional static site generator.