feat(sync): add Find Section navigation between editor and preview#215
Closed
ThisIs-Developer wants to merge 2 commits into
Closed
feat(sync): add Find Section navigation between editor and preview#215ThisIs-Developer wants to merge 2 commits into
ThisIs-Developer wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying markdownviewer with
|
| Latest commit: |
d54319c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://caa1b4a8.markdownviewer.pages.dev |
| Branch Preview URL: | https://fix-find-section-navigation.markdownviewer.pages.dev |
Owner
Author
|
Follow-up fix pushed in What was wrong:
What changed:
Retested:
|
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.
What feature was added
Adds a new Find Section button to the existing Find & Replace panel. When active, users can click or select content in the raw Markdown editor or click rendered content in the preview to locate the matching section in the opposite pane.
Why it is needed
Ratio-based scroll sync can drift when a small Markdown source block renders into a large preview block, such as an image, table, code block, Mermaid/PlantUML/Graphviz/D2/Vega-Lite/WaveDrom/Markmap/ABC diagram, or STL preview. Find Section gives users a manual one-shot way to jump to the matching source or rendered block.
How Find Section works
aria-pressedstate.Editor-to-preview mapping
startLine/endLineasdata-source-line,data-source-start, anddata-source-end.Preview-to-editor mapping
data-source-start/data-source-end.Files changed
index.html- adds the Find Section button to the Find & Replace UI.script.js- adds pick mode state, source-range stamping, editor/preview locate helpers, event handlers, and cancellation behavior.styles.css- adds button active styling, pick cursor styling, temporary highlights, and non-blocking locate message styling using existing tokens.Manual tests performed
node --check script.jsgit diff --check(clean; only existing line-ending warnings from Git on Windows)http://127.0.0.1:8765/with the provided manual test Markdown.aria-pressed.data-source-start=7), table (13), code (21), and Mermaid (30).Finalreturned two matches in editor and preview).Known limitations
Compatibility confirmations
mainwas not updated directly; all work was done onfix/find-section-navigation.