Open bitmand opened 1 year ago
I encountered the same issue. Additionally, in code blocks inside of embeds, tabs (\t) do not get rendered in-between text.
The above two messages are renditions of the same text, and there is also a leading space in front of the first character that doesn't get rendered.
Problem
When I send a message where the first characters, in the first line, in a code block, is whitespaces, like this:
Then the prepended whitespaces is removed from the first line, when displayed on Android and message looks like this:
On Discord Desktop and iOS app, the same message is rendered the way I would expect it:
A Wild Guess Appears
I tested this markdown code block regex, but the matching seems to work correctly:
val language = ...
)val codeBody = ...
)So my suspicion is that
codeBody
is trimmed (removing all prepending- and appending whitespaces, newlines etc.) later on. That would explain why it only happens on the first line of the code block.But the only use of
trim()
I can find is in MarkdownRules.kt in aoverride fun parse()
function:..and I have zero idea if it's related in any way.
There is also the possibility that this bug is outside of SimpleAST .. ?