Skip to content

feat(core): hide the noLink magic comment in every mark mode - #523

Open
ocavue wants to merge 7 commits into
masterfrom
magic-comment-hidden-all-modes
Open

feat(core): hide the noLink magic comment in every mark mode#523
ocavue wants to merge 7 commits into
masterfrom
magic-comment-hidden-all-modes

Conversation

@ocavue

@ocavue ocavue commented Aug 30, 2026

Copy link
Copy Markdown
Member

The noLink magic comment is editor metadata, so it now renders as an always-hidden mdMagic run in every mark mode instead of dim source text in show mode. The hidden-run caret rules (snap, Enter relocation, backspace dissolve) now cover magic runs in focus and show mode too, so deleting into the comment removes it whole and the URL autolinks again.

Summary by CodeRabbit

  • New Features
    • Added support for preserving noLink magic comments through Markdown conversion and clipboard operations.
    • Magic comments remain hidden in all display modes while retaining their underlying metadata.
    • Improved caret navigation, editing, deletion, undo, and autolinking behavior around hidden magic comments.
  • Bug Fixes
    • Fixed inconsistent handling of hidden comments across show, focus, and hide modes.
    • Ensured semantic clipboard output excludes magic comments while preserving them in Markdown data.

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
meowdown Ready Ready Preview Aug 30, 2026 4:18pm

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78b57218-3fbc-480b-8b4b-aaef969bdc75

📥 Commits

Reviewing files that changed from the base of the PR and between cd582b7 and 109cdd4.

📒 Files selected for processing (15)
  • packages/core/src/converters/roundtrip.test.ts
  • packages/core/src/extensions/clipboard/plain-text.test.ts
  • packages/core/src/extensions/clipboard/semantic-inline.test.ts
  • packages/core/src/extensions/hidden-run-caret.test.ts
  • packages/core/src/extensions/hidden-run-caret.ts
  • packages/core/src/extensions/hidden-run.ts
  • packages/core/src/extensions/inline-marks.ts
  • packages/core/src/extensions/inline-text-to-mark-chunks.test.ts
  • packages/core/src/extensions/inline-text-to-mark-chunks.ts
  • packages/core/src/extensions/mark-mode.test.ts
  • packages/core/src/extensions/mark-names.ts
  • packages/core/src/extensions/virtual-caret.ts
  • packages/core/src/style.css
  • packages/core/src/testing/selection-snapshot.ts
  • packages/react/src/components/markdown-view.test.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds the mdMagic mark for noLink comments. URL conversion, visibility, caret handling, clipboard serialization, rendering, and markdown roundtrips now preserve or hide these comments according to the active mode.

Changes

Magic comment handling

Layer / File(s) Summary
Magic comment representation and URL conversion
packages/core/src/extensions/mark-names.ts, packages/core/src/extensions/inline-marks.ts, packages/core/src/extensions/inline-text-to-mark-chunks.ts, packages/core/src/extensions/*test.ts
mdMagic is registered as Markdown syntax. noLink comments are attached to URL units with the mdMagic mark.
Hidden-run predicate and caret interaction
packages/core/src/extensions/hidden-run.ts, packages/core/src/extensions/hidden-run-caret.ts, packages/core/src/extensions/virtual-caret.ts, packages/core/src/testing/selection-snapshot.ts, packages/core/src/extensions/hidden-run-caret.test.ts
Hidden-run operations use the active mode predicate. Caret movement, splitting, deletion, undo, and caret-tail calculation cover magic comments in show and focus modes.
Rendering, clipboard, and roundtrip behavior
packages/core/src/style.css, packages/core/src/extensions/clipboard/*, packages/core/src/extensions/mark-mode.test.ts, packages/core/src/converters/roundtrip.test.ts, packages/react/src/components/markdown-view.test.tsx
Magic comments render as zero-width spans. Clipboard and roundtrip tests verify comment preservation or removal by mode.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 109cd

The change hides noLink metadata consistently and preserves atomic deletion and URL relinking across mark modes; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: maccman

Sequence Diagram(s)

sequenceDiagram
  participant MarkdownInput
  participant walkUnlinkedURL
  participant ProseMirrorDocument
  participant getHiddenPredicate
  participant createSnapPlugin
  MarkdownInput->>walkUnlinkedURL: URL followed by noLink comment
  walkUnlinkedURL->>ProseMirrorDocument: create mdPack and mdMagic
  ProseMirrorDocument->>getHiddenPredicate: active mark mode
  getHiddenPredicate-->>createSnapPlugin: hidden-run predicate
  createSnapPlugin->>ProseMirrorDocument: adjust caret position
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.19% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 14 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: hiding the noLink magic comment in every mark mode. It matches the pull request objectives and changes.
Full details: Docstring Coverage

Explanation

Docstring coverage is 76.19% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 14 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch magic-comment-hidden-all-modes

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.

@ocavue ocavue changed the title magic comment hidden all modes feat(core): hide the noLink magic comment in every mark mode Aug 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 109cdd4

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 94.1% 5093 / 5412
🔵 Statements 91.82% 5754 / 6266
🔵 Functions 92% 1219 / 1325
🔵 Branches 87.82% 3728 / 4245
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/style.css 0% 0% 0% 0%
packages/core/src/extensions/hidden-run-caret.ts 92.18% 86.53% 100% 94.23% 39, 103, 127, 136-137
packages/core/src/extensions/hidden-run.ts 93.91% 91.81% 100% 100% 49, 104, 106, 123, 126, 146, 213
packages/core/src/extensions/inline-marks.ts 88.88% 0% 91.17% 88.88% 125-126, 187, 249
packages/core/src/extensions/inline-text-to-mark-chunks.ts 95.45% 92.38% 100% 96.65% 345, 357, 376-377, 515, 524, 576, 677, 732, 778-779, 882
packages/core/src/extensions/mark-names.ts 100% 100% 100% 100%
packages/core/src/extensions/virtual-caret.ts 99.08% 94.33% 100% 100% 124
packages/core/src/testing/selection-snapshot.ts 100% 100% 100% 100%
Generated in workflow #2079 for commit 109cdd4 by the Vitest Coverage Report Action

@ocavue
ocavue force-pushed the magic-comment-hidden-all-modes branch 2 times, most recently from f0d8c9e to 7dbd8ac Compare August 30, 2026 15:47
@ocavue
ocavue force-pushed the magic-comment-hidden-all-modes branch 2 times, most recently from a5db555 to 53a8f1e Compare August 30, 2026 16:06
Base automatically changed from nolink-pack-inline-box to master August 30, 2026 16:14
@ocavue
ocavue force-pushed the magic-comment-hidden-all-modes branch from 227e4c7 to be49687 Compare August 30, 2026 16:14
@ocavue
ocavue force-pushed the magic-comment-hidden-all-modes branch from be49687 to b82a9a6 Compare August 30, 2026 16:15
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