JavaScript-empowered Markdown with dynamic syntax extensions
Created by J. McKenzie Alexander
📅 15 April 2025
jmarkdown is a powerful markdown interpreter that allows you to define new syntax extensions within the markdown file. These can be:
- Simple: Custom delimiters using any Unicode symbol.
- Complex: Regex-based extensions for matching patterned text in the file.
- JavaScript functions: Define a JavaScript function in special
<script>code blocks and then call it directly from the markdown text, as the markdown file is processed.
It also allows post-processing of the HTML to manipulate output or modify the generated HTML with Cheerio.
🔗 View the detailed documentation!
Download the source and then type
npm installand then
npm linkto make the jmarkdown executable available from the command line.
- Custom syntax (which can be disabled, if you prefer default Markdown syntax) for:
- Italics (
/italics/) - Boldface (
*boldface*) - Underline (
__underline__)
- Italics (
- Subscript/Superscript:
H_2O,E=mc^2 - Alignment blocks: right (
>> text) and center (>> text <<) - Add
.classand#idto elements with directive syntax:{.class #id} - Description lists with support for nested description lists.
- Support for emojis (:heart:), FontAwesome icons
- GitHub-style tables and alerts
- Footnotes via
marked-footnotes - Directives syntax for:
- Commenting out content
- Including/excluding sections (
Optionals:in metadata) - Creating advanced containers for custom processing (strategic-form games, TiKZ diagrams, Mermaid diagrams, demonstrating markdown code, etc.)
- Math with MathJax
- Mermaid diagrams
- TiKZ support via LaTeX and
dvisvgm(SVG export) - Extended list styles: alphabetical, Roman numerals, checklists
- Syntax highlighting via
highlight.js - Bibliographic references using Biblify
- Auto-generated Table of Contents
- Strategic-form game
- Demo environments showing raw/parsed markdown (
:::markdown-demo) - File inclusion
- Metadata header for:
- Configuration
- Parameter variables (
{{myvar}}) - Defining new markdown syntax
- Inline and post-processing scripts
Italic + Bold + Underline Nesting:
__underline with *bold* and /italic/ is possible__Custom Directives:
:::comment
This content is hidden unless `{include=true}` is written
after the `:::comment` opening tag above.
:::Strategic-form game:
:::game
Rock & Paper & Scissors
Rock & (0,0) & (-1,1) & (1,-1)
Paper & (1,-1) & (0,0) & (-1,1)
Scissors & (-1,1) & (1,-1) & (0,0)
row: Player 1
column: Player 2
caption: Rock-Paper-Scissors
:::Mermaid Diagram:
:::mermaid
graph LR
A --> B
B --> C
:::MIT
J. McKenzie Alexander — https://jmckalex.org