fix(sync): improve raw editor and preview scroll synchronization#214
Closed
ThisIs-Developer wants to merge 2 commits into
Closed
fix(sync): improve raw editor and preview scroll synchronization#214ThisIs-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: |
a667992
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8173ac34.markdownviewer.pages.dev |
| Branch Preview URL: | https://fix-markdown-preview-scroll.markdownviewer.pages.dev |
Owner
Author
|
Closing without merge per maintainer request. |
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 changed
Why it changed
The old sync mapped editor and preview scroll positions by total scroll percentage only. That breaks when one short Markdown line renders into a tall preview block, such as an image, diagram, table, code block, ABC/STL preview, or other visual renderer. After the tall block, the next section could drift or jump because the raw and rendered heights no longer matched.
A follow-up issue also showed an end-of-document mismatch: the rendered preview could reach the bottom while the raw editor remained around the middle of a long Graphviz/DOT source block. The sync now treats top and bottom boundaries as hard anchors before using block mapping.
New synchronization approach
Priority order:
Implementation details:
data-source-start,data-source-end, anddata-source-lineto committed preview blocks without changing rendered Markdown output.Files changed
script.jsdesktop-app/resources/js/script.jsTesting
node --check script.jsnode --check desktop-app/resources/js/script.jsgit diff --checkpython -m http.server 4173 --bind 127.0.0.100line-scroll delta0delta from max scroll0delta from max scroll4. Complex Diagram (Data Structures & HTML Labels)with many raw DOT lines and compact rendered output.0.0.node desktop-app/prepare.jsKnown limitations
Scope notes