In fact, there are a few different kinds of extensions you need
to make room for:
- operate on raw text and yield a block element
- operate on raw text and yield an inline element
- operate on commonmark block content and yield a block element
- operate on commonmark inline content and yield an inline element
In pandoc, we’ve developed a system that works well for all four.
-
fenced code block with structured attributes or a “raw”
annotation``` {=dot} graph graphname { a -- b -- c; b -- d; } ```
-
inline code backticks with structured attributes or a “raw”
annotation$x^2$
{=latex} -
fenced div with structured attributes
::: warning 1. Don't read this. 2. Or you'll regret it. :::
-
bracketed inlines (as in links) with structured attributes
[This is *colored* text]{color=red}
The attributes can be intercepted in a filter which can do
as it likes with the contents.
This has been quite a flexible system, and it degrades well
(in pandoc) when you don’t have the filter.