In order to become more familiar with the implementation of Markdown, I spent my free time today extending the language with a new syntax for embedding mathematical notation. Extending Markdown was not entirely trivial, even though my new syntax did not conflict with any other Markdown syntax, but the results are pretty satisfying:
$$ n! \equiv \prod_{i=1}^n i =
$$ 1 \cdot 2 \cdot \ldots \cdot n
turns into
The in-line environment is also available. For instance, the sum , written
1 + 2 + \ldots + n
has a well-known closed form (apocryphally due to Gauss):
Formatting often changes between environments to avoid ugly line spacing; for instance, here is the in-line version of that sum: .

The more I think about it, the less sense parsing with regular expressions makes (lexing is a perfect application for regular expressions, but parsing and lexing are two different stages). I'm tempted to write a more principled, extensible markdown language, just to prove a point.