m->d: Discord code block cannot contain its delimiters #38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Inline code delimited by one backtick cannot contain one backtick.
Inline code delimited by two cannot contain two.
The above cases are handled by discord-markdown.
However, the situation is impossible to resolve when the inline code contains BOTH one and two backticks - neither delimiter would work. The inline code could be converted to a code block, maybe.
Inline code can contain 3 or more backticks in a row, but code blocks cannot.
To do
If somebody tries to use inline code with both delimiters in it, it should be converted to a code block.
If somebody tries to use a code block with 3 or more backticks, we should upload their code as a file instead.
Technical details
While walking the parsed HTML tree of the Matrix message, search for the backticks in code blocks in the parsed HTML and replace them there. Add the attachment. Then hit Turndown.
This was done for code blocks in
77b7772062
using the HTML tree walker.