I was writing a reply in a comment just recently and I realized I could not turn something into a code block if it started and ended with a space. The particular comment in question is here. After a little trial and error, I have come to the following conclusions:
- In comments, the backticks are just rendered as literal backticks. They do not turn into a code block.
- In both questions and answers, the spaces are trimmed and it is rendered as a code block, but just as if the spaces were not there.
- In both questions and answers, you can work around this problem using <code> tags, but in comments, these also render literally.
Are there any workarounds for comments? Can this be fixed? If anyone is wondering why this is important, I was writing a regex string in which the spaces were a critical part of the regex. The match needed to start and end with a literal space. So yes, there is a real need for this.
test
Looks like you can work around it by adding a zero-width space next to the backtick, not sure if that might cause any copy-paste problems though. test
\s
matches any whitespace, including spaces, tabs, and newlines. A literal space is more specific, and in this case, the OP was clear that they only wanted to use space as a delimiter.copy("\u200b")
in the console. Gonna sanity-check real quick: test
- yep, 200b works"\x20test\x20"
should work in that case..." (.+) (.+) "
is natural.