Don't just write Markdown, write a Markdown.

1.  Philosophy

Have you ever seen a thousand dollar coffee table in the store and thought: "I could build that so much better and cheaper."? Two months later, you've spent three thousand dollars on new tools, you're on prototype seventeen, and the house is full of sawdust.

If you're like me, you know the best excuses to use with your wife, including the classic: "Honey, now that we own all these tools, think how much we'll save next time!".

She doesn't buy it, but she tolerates the mess because she gets it. If you get it, welcome to prototype seventeen! If you don't, please ignore the sawdust.

—Jordan

2.  Wordcel

Wordcel is the slightly embarassing name I've given to the Markdown variant I designed for this website. Using wordcel, I can write blog posts in .wc files, using a convenient syntax I designed myself. The wordcel build script parses those .wc files and emits the HTML for this site.

There are hundreds of similar tools for generating static sites, but wordcel has one killer feature: It's mine. I built it. I own it. I understand it. If I want to add a convenient syntax for obnoxious sarcasm, I JuSt bUiLd iT MySeLf!

The rest of this post explains the inner workings of the wordcel parser and documents the wordcel syntax.

3.  Recursive Decent [sic] Parsing

The wordcel parser uses Recursive Decent Parsing, an algorithm I invented that should not be confused with other similarly named algorithms. The wordcel parser recursively subdivides a wordcel document into pieces. Since it does a decent job parsing each piece, I call it a recursive decent parser.

The wordcel grammar can be represented in BNF (Big Nasty Flowchart) form. This is a standard notation I invented to represent complexity free grammars (CFG) like wordcel.

At this point, the document has been subdivided into blocks. Code blocks, math blocks, aside blocks, and quote blocks can all be parsed without further recursion. Text blocks are more complicated because they can include headers, links, images, and text formatting that all need to be broken down and processed.

4.  Wordcel Syntax

4.1  Text Blocks

To format text, start writing!
Text blocks are just paragraphs with no other special attributes.

To format text, start writing! Text blocks are just paragraphs with no other special attributes.

4.1.1  Headings

# This renders as an <h1> header.
## This renders as an <h2> header.
### This renders as an <h3> header.
#### This renders as an <h4> header.
##### This renders as an <h5> header.
###### This renders as an <h6> header.

4.1.2  Bold & Italic

You can emphasize text using *enclosing asterisks*.

You can emphasize text using enclosing asterisks.

You can italicize text using _enclosing underscores_.

You can italicize text using enclosing underscores.

4.1.3  Inline Code

To format code within a text block, surround it with single backticks. The pygments lexer will guess which language lexer to use. Here is an example: int main(int argc, char* argv[]) { return 0; }

4.1.4  Inline Math

To format inline math, enclose a latex equation between single dollar signs.

For example, this sentence $ax^2 + bx + c = 0$ includes an inline equation.

For example, this sentence $ax^2 + bx + c = 0$ includes an inline equation.

4.1.5  Images

The syntax to include images is similar to the syntax used in Markdown.

![Here is a picture of me!](me.jpg:25%)

Here is a picture of me! Here is a picture of me!

4.1.6  Links

Links use the same syntax as markdown. The display text goes in square brackets, and the URL goes in parentheses.

Here is an example link: [google.com](https://google.com)

Here is an example link: google.com

4.2  Code Blocks

# This is what a python3 code block looks like after syntax highlighting.
def hello_python():
  print("Hello, python!")
// This is what a C++ code block looks like after syntax highlighting.
void hello_cpp() {
  std::cout << "Hello, C++!" << std::endl;
}

4.3  Math Blocks

$$x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$

4.4  HTML Blocks

You can use three quotation marks to set off a block of verbatim HTML. This provides an escape hatch to allow you to do things like embed a tweet.

Be on the lookout for my next publication in the Journal of (Baseball) Field Robotics pic.twitter.com/RrFdV3diLR

— Jordan Ford (@jrdnfrd) June 3, 2021

4.5  Asides

~~~
This is an aside!
~~~

4.6  Blockquotes

" This is a blockquote!"
"""
This is a blockquote!
"""