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

(#422) Bug Fixed markdown

Summary

Currently, when sending a message like so:
```text
something
Fluxer will render it as a codeblock with the text something, without requiring the closing ``` string. On Discord, pressing Enter in a message with only one ``` will instead add a newline.

Steps to reproduce

  1. type ```
  2. (optionally) add text on a new line
  3. send message

1 comment

Sign in with Fluxer to comment and vote.
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.