Skip to content

Add line-number gutter to the Markdown editor - #9

Merged
raj-khan merged 1 commit into
mainfrom
feat/editor-line-numbers
Jun 25, 2026
Merged

raj-khan merged 1 commit into
mainfrom
feat/editor-line-numbers

Conversation

@raj-khan

Copy link
Copy Markdown
Owner

What

Adds a line-number gutter down the left edge of the Markdown editor.

How

A new CodeArea component wraps the editor <textarea> and renders a gutter beside it. Because a plain textarea can't draw a gutter, a hidden mirror node replicates the textarea's exact text rendering to measure how many visual rows each logical line wraps to. The gutter reserves matching height per number and is translated in lock-step with the textarea's scroll, so:

  • Each logical line gets exactly one number, even when long prose soft-wraps across several rows.
  • Numbers stay aligned while scrolling.
  • It remeasures on edit (coalesced per frame), on resize (width changes wrapping), and once web fonts load.

The gutter is aria-hidden and non-selectable, so it stays out of the accessibility tree and copy/paste.

Verify

  • tsc --noEmit and eslint clean.
  • Verified visually: a wrapped 3-row prose line shows a single number, with all following lines correctly aligned.

Wrap the editor textarea in a CodeArea component that renders a
scroll-synced line-number gutter. A hidden mirror measures how many
visual rows each logical line wraps to, so numbers stay aligned even
when prose soft-wraps.
@vercel

vercel Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
markdowntopdf Ready Ready Preview, Comment Jun 25, 2026 4:55pm

@raj-khan
raj-khan merged commit 3468cac into main Jun 25, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — fe96dc27 Deployed Jun 25, 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.

1 participant