RexSystem1 voteoriginally by @cproudlock on GitHub
The issue is in packages/markdown_parser/src/parsers/BlockParsers.tsx in the parseCodeBlock() function (around line 627-634).
When the parser encounters an opening fence (```) but reaches EOF without finding a closing fence, it falls through to an unconditional return that still creates a valid CodeBlock node:
The fix would be to return null instead of a CodeBlock when no closing fence is found, so the content is treated as regular text. Something like tracking whether the closing fence was matched and guarding the return:
if(!closingFenceFound)returnnull;
Worth noting: some markdown implementations (like GitHub) do render unclosed code blocks to EOF — so this is a design choice. If the intent is to match Discord behavior (which doesn't render without closing backticks), then returning null is correct.
Thread
Comment by @cproudlock
packages/markdown_parser/src/parsers/BlockParsers.tsxin theparseCodeBlock()function (around line 627-634). When the parser encounters an opening fence (```) but reaches EOF without finding a closing fence, it falls through to an unconditional return that still creates a validCodeBlocknode:nullinstead of a CodeBlock when no closing fence is found, so the content is treated as regular text. Something like tracking whether the closing fence was matched and guarding the return:nullis correct.