[pull] develop from marktext:develop#110
Merged
Merged
Conversation
…4811) * fix(muya): show and slug TOC headings by rendered plain text (#4811) `getTOC()` returned each heading's raw source, so a heading authored with inline markdown surfaced in the outline verbatim — `**bold**`, `[label](url)`, `` — instead of the text a reader sees. It also derived `githubSlug` from that raw source, so the anchor id never matched the one the HTML export injects from `heading.textContent`, breaking copied heading anchors and in-editor `#anchor` links for any heading containing formatting. Run the heading's inner text through the inline tokenizer and collapse the tokens to their visible text (new `tokensToPlainText`): emphasis/strike markers drop, a link renders as its label, an image as its alt. `content` and `githubSlug` now both use that plain text, fixing the outline display and realigning the slug with the export anchor id. Supersedes the image-only regex approach in #4811 with an engine-side fix that covers every inline construct. * test(desktop): export TOC anchors now match heading ids (#4811) `getTOC()` now yields rendered plain text, so the export `[TOC]` block (`getHtmlToc`) slugs a formatted heading to the same id the engine injects from `heading.textContent`. Update the fixture to the plain-text content the engine produces and flip the former `SLUG DIVERGENCE` characterization — which locked in a dead export anchor — to assert the anchor and heading id now converge.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )