Skip to content

Dev - #8

Merged
atom-tech9 merged 2 commits into
mainfrom
dev
Jul 6, 2026
Merged

Dev#8
atom-tech9 merged 2 commits into
mainfrom
dev

Conversation

@atom-tech9

Copy link
Copy Markdown
Owner

Summary

Type of Change

  • feat — new feature
  • fix — bug fix
  • docs — documentation only
  • refactor — code change that neither fixes a bug nor adds a feature
  • chore — tooling / maintenance
  • test — adding or updating tests
  • perf — performance improvement
  • ci — CI / build changes

Screenshots

Checklist

  • npm run typecheck passes
  • npm run lint passes
  • npm run build passes
  • Follows the project code style (no any, immutable updates, logical CSS)
  • i18n keys added for any new user-facing strings (en and ar)
  • RTL layout verified for UI changes
  • No console.log (uses @/lib/logger)
  • Documentation updated if needed

… view

Replaces the linear scrollTop-fraction sync (which drifted badly on
tables/images/code, since a source line and its rendered block have
wildly different heights) with source-line anchoring, the technique
used by VS Code/Typora/Obsidian:

- rehypeSourceLine stamps data-source-line on block elements (runs
  before rehype-raw so mdast positions survive)
- parseFrontmatter exposes bodyLineOffset so editor lines (which
  include front-matter) map to body-relative preview lines
- useScrollSync maps a fractional source line between panes and
  interpolates between anchors; the pane the user physically scrolls
  is the driver, the other follows — programmatic follower scrolls
  never bounce back (input-keyed lock, not a fragile timeout)
- bidirectional: scrolling the preview now moves the editor too
- a Link2/Link2Off toggle in the preview (split view only), persisted
  to scripto:scroll-sync

Verified end to end on a table-heavy doc: the same paragraph stays
aligned on both sides in both directions.
A flowchart TD taller than the page rendered fine in the (scrollable)
preview but exploded to 5+ pages in the PDF: an unbreakable element
taller than the page content box makes Paged.js fail to place it, and
when it splits a Mermaid SVG the diagram's inner <style> leaks as
visible '#mermaid-1{...}' text on the overflow pages.

The export CSS now caps figure/diagram/image height to the page's
content box minus a buffer for the preceding heading (headings carry
break-after: avoid) and the figure's own margins, with width:auto so
the aspect ratio is preserved. Oversized diagrams scale down to fit
one page intact; normal-sized ones are untouched. Verified: the 8-node
stack went from 7 export pages to 1, no style-text leak.
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scripto Building Building Preview, Comment Jul 6, 2026 12:59pm

Request Review

@atom-tech9
atom-tech9 merged commit 924e961 into main Jul 6, 2026
2 of 3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 3feab4dc Deployed Jul 6, 2026 by vercel[bot]
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.

2 participants