Markdown Parser Demo

  markdown

This document demonstrates some of the capabilities of my static site generator, Runestone, and custom markdown parser, written in Odin. The parser handles standard markdown syntax along with several personal extensions for my own convenience. I'll likely make the code public once it's in a more stable state.

Text Formatting

Basic text formatting includes bold text for emphasis, italic text for subtle emphasis, and highlighted text for marking important passages. I can also use inline code when referencing function names or variables.

The parser also supports sidenotesSidenotes appear in the margin and provide additional context without interrupting the flow of the main text. This is a really long sidenote because I want to see how the formatting looks. which are perfect for commentary and references. Multiple sidenotesLike this one. can appear in the same paragraphAnd this one too! without breaking the layout.

Mathematics

Inline mathematics like \( E = mc^2 \) flows naturally within paragraphs, while display mathematics receives its own block:

$$ \int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} $$

This makes it ideal for technical writing and mathematical exposition.

Code Blocks

The parser code blocks, where syntax highlighting is done via highlight.js.I wanted to roll my own syntax highlighter, but very quickly realized that it's not easy...

#include <stdio.h>
int main() {
    printf("Hello, World!\n");
    return 0;
}

Lists and Structure

Unordered lists work great for non-sequential information:

Ordered lists are perfect for step-by-step instructions:

  1. Parse the markdown source
  2. Build an abstract syntax tree
    1. Tokenize the input
    2. Construct the tree structure
  3. Render to HTML

Quotations

Block quotes handle citations and extended passages:

The best writing is rewriting. This applies to both prose and code.

Nested quotes work for discussions:

The parser handles arbitrary nesting depth. Each level is properly indented and styled.

Misc

My parser also supports formatting within sidenotes!For example, this is a link, here is some inline code, and this is a bolded word.

Todo

A list of features my static site generator and parser don't support yet: