fix(core/markdown): restore data-include markdown rendering with marked v16#5117
Open
Copilot wants to merge 3 commits intodependabot/npm_and_yarn/marked-16.3.0from
Open
fix(core/markdown): restore data-include markdown rendering with marked v16#5117Copilot wants to merge 3 commits intodependabot/npm_and_yarn/marked-16.3.0from
Copilot wants to merge 3 commits intodependabot/npm_and_yarn/marked-16.3.0from
Conversation
Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Replace reindent() with normalizeIndent() in markdownToHtml() to handle mixed-indentation HTML. In marked v16, HTML with 4+ spaces of indentation is treated as a code block per CommonMark. When data-include renders markdown into sections, the resulting content has lines at column 0 which broke the old min-indent calculation. The new normalizeIndent() uses the first non-empty line's indentation to determine the strip amount, correctly handling outer HTML structure with inner 0-indent content from rendered markdown. Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update marked dependency from 12.0.2 to 16.3.0
fix(core/markdown): restore data-include markdown rendering with marked v16
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades marked 12→16. The new version is stricter CommonMark-compliant: HTML indented 4+ spaces is treated as a code block, not an HTML block. This broke
data-include-format="markdown"when combined withformat: "markdown"— rendered section content ended up escaped inside<pre><code>blocks.Changes
Renderer API (
code,image,heading)marked v16 changed renderer method signatures from positional args to token objects:
Indentation normalization (
normalizeIndent)When data-include renders markdown into a
<section>, the resulting HTML has lines at column 0 (<ol>,<li>, etc.). The oldreindent()used minimum indentation across all lines — inner content at col 0 madeleastIndent = 0, leaving outer sections at 8–10 spaces untouched. marked v16 then treated those sections as indented code blocks.Replaced
reindent()inmarkdownToHtml()with a localnormalizeIndent()that strips based on the first non-empty line's indentation rather than the minimum. This correctly removes the outer document indentation regardless of how inner rendered-HTML content is indented.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.