Skip to content

feat(markdown): use LF offsets for AST positions - #667

Merged
ocavue merged 1 commit into
masterfrom
refactor/lf-positions
Oct 4, 2026
Merged

ocavue merged 1 commit into
masterfrom
refactor/lf-positions

Conversation

@ocavuebot

Copy link
Copy Markdown
Collaborator

This PR keeps the single \r\n to \n conversion at the start of parseMarkdownAst, and removes the code that mapped every position back onto the \r\n source. Positions now index the text with \n line endings, which is the same as the source for a host that passes \n text.

A host that stores notes with \r\n should convert them once where it reads the file, so the rest of its code and this library share one coordinate system.

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
meowdown Ignored Ignored Oct 4, 2026 8:10am UTC

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4eba1a26-3831-44a2-afed-0099c9d0df8b
📥 Commits

Reviewing files that changed from the base of the PR and between adde824 and 0a0b7e0.

📒 Files selected for processing (6)
  • .changeset/markdown-lf-positions.md
  • packages/core/src/converters/paragraph.ts
  • packages/markdown/README.md
  • packages/markdown/src/ast/check-roundtrip-fuzz.test.ts
  • packages/markdown/src/ast/parse.ts
  • packages/markdown/src/ast/position.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@meowdown/core@667
npm i https://pkg.pr.new/@meowdown/embed@667
npm i https://pkg.pr.new/@meowdown/markdown@667
npm i https://pkg.pr.new/@meowdown/react@667

commit: 0a0b7e0

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 94.54% 5757 / 6089
🔵 Statements 92.33% 6504 / 7044
🔵 Functions 92.59% 1414 / 1527
🔵 Branches 88.77% 4443 / 5005
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/converters/paragraph.ts 100% 100% 100% 100%
packages/markdown/src/ast/parse.ts 97.76% 90.68% 100% 98.86% 277-280, 366, 379, 958, 967
Generated in workflow #2641 for commit 0a0b7e0 by the Vitest Coverage Report Action

@ocavue ocavue changed the title refactor(markdown)!: index position in \n text instead of mapping back to \r\n feat(markdown): use LF offsets for AST positions Oct 4, 2026
@ocavue
ocavue marked this pull request as ready for review October 4, 2026 08:32
@ocavue
ocavue self-requested a review as a code owner October 4, 2026 08:32
@ocavue
ocavue merged commit 7eb8d75 into master Oct 4, 2026
14 checks passed
@ocavue
ocavue deleted the refactor/lf-positions branch October 4, 2026 08:33
@ocavuebot ocavuebot mentioned this pull request Oct 4, 2026
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