commonmark-spec icon indicating copy to clipboard operation
commonmark-spec copied to clipboard

Documenting extensions with fenced example blocks

Open Crissov opened this issue 8 years ago • 0 comments

As documentend in README.md, the source file for the specification, spec.txt, uses custom fenced code blocks wherein the info string starts with example .

```````````````````````````````` example
Markdown source
.
expected HTML output
````````````````````````````````

Github has documented their GFM extensions to Commonmark in a file called extensions.txt using the same convention. I wish there was a handy way to include all three, i.e. input, standard HTML output and extended HTML output, in these blocks. The intuitive solution is another dividing line containing only a single period character. I am not sure which output should come first, though.

```````````````````````````````` example
Markdown source
.
expected HTML output in vanilla Commonmark
.
expected HTML output with extension
````````````````````````````````

By the way, in some instances I would have preferred to provide expected output in a different format than HTML, e.g. LaTeX. For such flexibility, there would need to be greater changes to the syntax and the Lua script parsing it.

```````````````````````````````` example
## Heading ## -
.tex
\section*{Heading}
.ast
<heading level="2" info="-">Heading</heading>
.
<h2>Heading</h2>
.
<h2 class="notoc">Heading</h2>
````````````````````````````````

Crissov avatar Jan 01 '18 17:01 Crissov