Skip to content

[PR] fix: keep Markdown inline code literal in handoff rendering - #6696

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_literal-inline-code
Nov 14, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_literal-inline-code

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

Handoff Markdown and the web panel currently interpret markup inside inline code a second time. The renderer wraps a backtick span in <code> and then runs the image, emphasis, and link rules over its contents. Code examples can turn into active images/links or lose literal text instead of showing their source.

Change

Encode *, [ and ] inside the already HTML-escaped code span as numeric character references. Later Markdown rules cannot consume those delimiters, while the browser displays the original characters. The existing code-span recognition is retained. The shared factory remains self-contained for its minified browser embedding; no dependency or configuration surface is added.

Formatting surrounding code remains active, and code within a Markdown link label still renders inside that link.

Verification

  • Nine new cases: seven fail on unchanged base 9495c764d36909eec263f404d4802d68b608f23f, two controls pass. The controls preserve ordinary code and HTML escaping. Negative cases cover literal emphasis, image/link examples, rejected URL examples without text loss, code inside link labels, surrounding emphasis, and the minified/detached factory used by the browser.
  • 27/27 renderer tests pass after the change, including all 18 existing escaping, link/image restrictions, fences, lists, tables, syntax highlighting and browser inlining checks.
  • Tests compare the code element's decoded text with its original source and reject nested markup, rather than requiring a particular entity spelling.
  • npm run typecheck, npm run build, and git diff --check pass.
  • This is a shared renderer correction; no live user's documents or application data were used. The full repository test verdict remains with hosted CI.

Historical deduplication checked the complete Afloat16 production-patch index (no prior renderer changes) and related all-state results. The #5482 and #5901 head implementations still feed code contents into later replacements. #2270 edits the separate static website path, not this shared renderer.

Closes #6695.

@ranxianglei ranxianglei changed the title fix: keep Markdown inline code literal in handoff rendering [PR] fix: keep Markdown inline code literal in handoff rendering Nov 14, 2026
@ranxianglei
ranxianglei merged commit ac36b09 into ranxianglei:master Nov 14, 2026
48 checks passed
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.

Handoff and panel Markdown reinterpret images and links inside inline code

2 participants