Codeblocks should not be rendered unless theres a matching ``` string

(#422) Bug Fixed markdown

Thread

Comment by @cproudlock
RexSystem 1 vote originally 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:
return {
    node: {
        type: NodeType.CodeBlock,
        language,
        content: contentParts.join(''),
    },
    newLineIndex,
};
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) return null;
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.