LearnNewsExamplesServices
Frontmatter
id9265
titleFix markdown escaping for nested special code blocks
stateClosed
labels
bugdocumentationai
assigneestobiu
createdAtFeb 23, 2026, 11:34 AM
updatedAtFeb 23, 2026, 11:36 AM
githubUrlhttps://github.com/neomjs/neo/issues/9265
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 23, 2026, 11:36 AM

Fix markdown escaping for nested special code blocks

Closed v12.0.0 bugdocumentationai
tobiu
tobiu commented on Feb 23, 2026, 11:34 AM

Problem When a guide author wants to display a special markdown block (like neo-component, live-preview, or mermaid) inside a readonly code block without executing it, they currently have to use workarounds like because our block extractors ignore standard markdown nesting. If they escape it using ```` , the Highlight.js output causes the backslash to become separated from the backticks by HTML tags, preventing marked.js` from correctly unescaping them. This results in the leading backslash being visible to the user.

Solution

  1. Updated the special code block regexes to allow standard ```` escaping by checking for a preceding backslash via negative lookbehind(?<!\)`.
  2. Updated regexCodeBlock to correctly match blocks with 3 or more backticks so that the closing backticks match the opening ones.
  3. Added an unescape step right before passing the code to HighlightJs inside processReadonlyCodeBlocks to remove the backslash escaping.
  4. Updated the DevIndex ContentEngine.md guide to use the proper ```` ` escape sequence instead of the workaround.
tobiu added the bug label on Feb 23, 2026, 11:34 AM
tobiu added the documentation label on Feb 23, 2026, 11:34 AM
tobiu added the ai label on Feb 23, 2026, 11:34 AM
tobiu referenced in commit ea52b2b - "fix: Allow markdown escaping for nested special code blocks (#9265)" on Feb 23, 2026, 11:35 AM
tobiu assigned to @tobiu on Feb 23, 2026, 11:35 AM
tobiu
tobiu Feb 23, 2026, 11:35 AM

Input from Gemini 3.1 Pro:

✦ I've implemented the unescaping step (\``` to `) right before `HighlightJs` runs inside `processReadonlyCodeBlocks`. I have also modified the custom regex blocks (`regexLivePreview`, `regexMermaid`, `regexNeoComponent`) to ignore blocks preceded by a backslash using negative lookbehinds. Furthermore, `regexCodeBlock` has been updated to properly handle ` with 3 or more backticks so it properly pairs opening and closing sets.

The guide ContentEngine.md was also updated to use the formal escaping syntax instead of the visual workaround.

The changes have been committed and pushed to dev. Closing this issue.

tobiu closed this issue on Feb 23, 2026, 11:36 AM