Skip to content

BACK-476 - Fix-inline-code-HTML-escaping-in-markdown-renderer#650

Open
kuwork wants to merge 4 commits into
MrLesk:mainfrom
kuwork:fix-inline-code
Open

BACK-476 - Fix-inline-code-HTML-escaping-in-markdown-renderer#650
kuwork wants to merge 4 commits into
MrLesk:mainfrom
kuwork:fix-inline-code

Conversation

@kuwork
Copy link
Copy Markdown
Contributor

@kuwork kuwork commented May 13, 2026

Summary

Fixes double HTML-entity encoding inside inline code and fenced code blocks across all views that use the MermaidMarkdown renderer (wiki, task details, documentation, decisions, and file previews).

The sanitizeMarkdownSource helper was escaping < to &lt; indiscriminately across the entire markdown source. Because code regions are already rendered verbatim by the Markdown engine, this caused users to see &lt;id&gt; instead of <id> inside inline code like `<id>`.

The fix collects protected ranges for fenced code blocks and inline code spans before running the < escape replacement, skipping any match that falls inside a code region.

Related Tasks

closes BACK-476

📋 Important: All PRs must have an associated task in the backlog.

  • If no task exists, create one first using: backlog task create "Your task title"
  • Follow the task guidelines when creating tasks
  • Tasks should be atomic, testable, and well-defined with clear acceptance criteria

Task Checklist

  • I have created a corresponding task in backlog/tasks/
  • The task has clear acceptance criteria
  • I have added an implementation plan to the task
  • All acceptance criteria in the task are marked as completed

Testing

  • bunx tsc --noEmit passes with no new errors.
  • Verified manually that inline code containing < (e.g. `backlog task <id>`) now renders as <id> instead of &lt;id&gt; on wiki pages.
  • Confirmed that fenced code blocks with < are also preserved correctly.
  • Confirmed that regular text outside code regions still has <Something> escaped to prevent accidental HTML tag parsing.
  • Confirmed that URI autolinks (<mailto:...>) and email autolinks continue to work.

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.

1 participant