5 ms·
> In fact, a code fence need not consist of exactly three backticks or tildes. Any number of backticks or tildes is allowed, as long as that number is at least
by epage 8mo ago
> In fact, a code fence need not consist of exactly three backticks or tildes. Any number of backticks or tildes is allowed, as long as that number is at least three
Unfortunately, some markdown implementations don't handle this well. We were looking at using code-fence like syntax in Rust and we were worried about people knowing how to embed it in markdown code fences but bad implementations was the ultimate deal breaker. We switched to `---` instead, making basic cases look like yaml stream separators which are used for frontmatter.
- bityard 8mo ago`---` is already used in Markdown for horizontal rules?
- _ache_ 8mo agoYeap, along with `+++`, `**` and mixing if I remember correctly. I don't understand the logic of using an non-standard syntax because some non-standard implementations may not render correctly. Actually, yes, now you know for a fact that none of the Markdown implementation will render it correctly. So, I guess, they used `~~~` instead and it was an error in OP post.
- nicoburns 8mo agoThe problem here is that if you use ``` as a token in a non-markdown language, then it's going to be very hard to embed that code in a markdown code block. That problem doesn't happen with other syntax as it's already escaped by the code block. `---` inside a markdown code block will render as a literal `---`.
- yencabulator 8mo agoTo embed content with multiple sequential backticks, use more backticks than the max run.
- nicoburns 8mo agoIn theory, yes. But not all markdown implementations support this properly.
- yencabulator 8mo agoThe CommonMark spec even has an example test case! The excuses for poor implementations are pretty thin.
- lilyball 8mo agoNot all markdown implementations are CommonMark
- yencabulator 8mo agoThere's not much reason to be anything else than CommonMark + extensions.
- lilyball 8mo agoFor new implementations, sure. But it's harder to change existing implementations (anything not already CommonMark-compatible will introduce unexpected changes to existing content if you switch to CommonMark), and especially for anything that's not being actively developed it's unlikely to ever change.