There are numerous cases where you want to separate a block of text that isn’t a blockquote, such as callouts, admonitions, examples, etc. That’s why HTML has <aside>
and <section>
elements. For example, you could be using markdown for an recipe blog, and you have special styling for the actual recipe. You’d need a way to mark that section so your styles could act on it. The :::
syntax is one of several proposals for this.
I agree with @jgm that it needs to be separate from code-fences. When entering a code block, you’re explicitly saying, “this area is not markdown”. Whereas :::
says, “This area is markdown, but it’s a distinct block”.
For code blocks, Markdown is agnostic to the contents. Defaulting to <pre>
formatting makes sense, but the rendering environment can do additional stuff with it if it wants to, from code highlighting to execution or transformation. If the author wants to provide hints as to how it should be rendered, then a metadata block makes sense and should be standardized. There’s really no getting around the fact that you’ll need to be able to send key-value pairs to the parser for this stuff. It’s data, not text. {#id .class key="val"}
is a fair option due to its flexibility.
That said, it would be of benefit to have a standard key and value to indicate “leave this as preformatted text”. For example: show=original
as opposed to show=chart
. If left blank, the environment chooses the default. Once standardized, a shorthand could be considered. So instead of ```{.mermaid show=original}
, it could be ```mermaid:original
.