LearnNewsExamplesServices
Frontmatter
id8396
titleEnhance Markdown parser to support implicit readonly code blocks
stateClosed
labels
enhancementai
assigneestobiu
createdAtJan 7, 2026, 9:46 PM
updatedAtJan 7, 2026, 9:55 PM
githubUrlhttps://github.com/neomjs/neo/issues/8396
authortobiu
commentsCount1
parentIssue8362
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJan 7, 2026, 9:55 PM

Enhance Markdown parser to support implicit readonly code blocks

tobiu
tobiu commented on Jan 7, 2026, 9:46 PM

Update Neo.component.Markdown to treat all code blocks as readonly by default, removing the requirement for the explicit readonly flag.

  1. Parsing Order: live-preview, neo-component, and mermaid blocks are already parsed first and replaced with placeholders.
  2. Generic Fallback: The parser will then match any remaining triple-backtick code blocks.
  3. Implicit Readonly: These blocks will be processed as readonly code blocks with syntax highlighting.
  4. Default Language: If no language is specified (e.g. just ```), it will default to plaintext.

This simplifies writing markdown for the portal and release notes.

tobiu
tobiu Jan 7, 2026, 9:54 PM

Input from Gemini 3 Pro:

✦ I have enhanced Neo.component.Markdown to support implicit readonly code blocks.

Changes:

  1. Generic Regex: Replaced the restricted regexReadonly with a generic regexCodeBlock that matches any triple-backtick block.
  2. Implicit Readonly: All code blocks are now processed as readonly blocks by default (after live-preview and other special blocks are extracted).
  3. Smart Defaults: If a language is not specified (e.g. ```) or is text, it defaults to plaintext.
  4. Robust Error Handling: The parser now catches errors from HighlightJS (e.g., if an unknown language is specified like ```java) and automatically falls back to plaintext highlighting, preventing parser crashes.

This simplifies writing markdown for the Portal and Release Notes, as readonly flags are no longer required.