For ordered lists, the “delimiter” used after the number is kept in the abstract syntax tree (AST) as an attribute. All other alternative syntaxes are not reflected in the AST at all (see [Dingus]), i.e. emphasis (
_), ATX vs. Setext heading, bullet list markers (
-), thematic break character (
-), code fence (
Why are enumerated list markers so special?
Filters working on the AST could be more versatile if they had access to that information in general.
The thought was that one might want to preserve the delimiter on output. LaTeX, HTML, etc. make it possible to have lists with ) instead of .
With emphasis, it was thought, there’s no such need – there aren’t two kinds of emphasis.
That was the thinking. Of course, keeping the information in the AST would allow lots of possibilities. And it would be useful for converting back to CommonMark.
That’s what I assumed.
The delimiters are not directly supported in HTML, though, just with CSS. But if we take that into account, there‘s also a case for the bullets which could be correlated with presentational HTML 3/4, e.g.
If I remember correctly, Latex does not support
item styles for
enumerate environments out of the box, i.e. a package like
enumerate was needed or each item’s label would have to be generated explicitly (including the number).
If a hint about actual marker used was available in the AST, someone could write filters or extensions that did something more reasonable like the following:
- Treat underscore emphasis as
b in HTML5 output,
ins?) for quadruple underscores.
- Auto-number ATX headings, don’t number Setext headings or
don’t put Setext headings into an automatically generated TOC or
sections for ATX headings only or
do any combination thereof.
- Treat one or two of the “thematic break” alternatives as
section boundaries in HTML5 output.
(@Dmitry once suggested to use “boundary” instead of “horizontal rule” or “thematic break”.)
Render images or formatted text for certain code blocks with tilde fences, but restrict to syntax-highlighting for back-tick fences. They could also differ just in default values for the parser-dependent info-string “attributes”, e.g. preset language, line numbers, whitespace visibility.