Skip to content

[Mermaid 1/4] Add literal fenced-code Markdown support - #3460

Open
Kyle Rubenok (krubenok) wants to merge 3 commits into
microsoft:masterfrom
krubenok:codex/mermaid-1-markdown
Open

Kyle Rubenok (krubenok) wants to merge 3 commits into
microsoft:masterfrom
krubenok:codex/mermaid-1-markdown

Conversation

@krubenok

@krubenok Kyle Rubenok (krubenok) commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

First layer of a four-PR Mermaid integration stack. This layer has no Mermaid dependency.

  • Parse backtick/tilde code fences before normal Markdown processing, preserving literal source, blank lines, and escapes.
  • Support quoted fences, list-item fences, list continuations, and unclosed container boundaries.
  • Preserve fence metadata through PRE Content Model containers, DOM conversion, and model cloning.
  • Add custom fenced-block import and recursive block export callbacks; thread import options through both Markdown paste paths.
  • Serialize code using collision-safe delimiters and recognize fences during Markdown auto-detection.

This extends the existing Markdown converter rather than claiming overall CommonMark compliance. Block content in pipe-table cells remains subject to the existing serializer's limitations.

Validation

  • yarn b: passed.
  • yarn eslint: passed.
  • yarn test:fast: 6,394 tests passed, exit code 0. Karma prints a page-reload warning after the successful total.
  • Added 15 focused fence/round-trip tests.

Stack

  1. [Mermaid 1/4] Add literal fenced-code Markdown support #3460: generic fenced-code Markdown import/export.
  2. [Mermaid 2/4] Add source entities and editor history krubenok/roosterjs#1: source-preserving diagram entities and history.
  3. [Mermaid 3/4] Isolate transient previews from snapshots krubenok/roosterjs#2: transient Shadow DOM previews.
  4. [Mermaid 4/4] Add lazy rendering and an isolated demo krubenok/roosterjs#3: lazy Mermaid rendering, scheduling, and isolated demo.

PR 1 targets upstream master. Each later PR targets the preceding branch in krubenok/roosterjs for an incremental review. Promote the dependent layers upstream after their prerequisites merge. Lower-layer fixes are merged forward without rewriting published history.

Validation follow-up

Declaration generation also passes after the import and named-return-type fixes. Firefox job 102362718902 in run 34319476781 failed before tests because the existing npm feed returned 503 Service Unavailable for @types/jasmine@3.5.10; that infrastructure failure is separate from the code fixes.

@JiuqingSong

Copy link
Copy Markdown
Collaborator

Hi, can you share a design spec about how is this whole feature working? Such as the input, output, technical design.

In general, the design of content model allows you to override any element processor to add your own content handling. So not all those customized content need to change the core code. You can first try to explore this direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants