Skip to content

fix: Inline code clears comments (BLO-1207)#2832

Open
matthewlipski wants to merge 2 commits into
mainfrom
comments-inline-code
Open

fix: Inline code clears comments (BLO-1207)#2832
matthewlipski wants to merge 2 commits into
mainfrom
comments-inline-code

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

@matthewlipski matthewlipski commented Jun 4, 2026

Summary

This PR fixes an issues where comments cannot overlap inline code. This is because the inline code mark has exclude: "_" in its spec, meaning no other marks can overlap it. This makes sense for things like colors and bold/italic/etc, but not comments. Therefore, an exception has been added.

Closes #2803

Rationale

This is a bug.

Changes

  • Extended Code mark with onBeforeCreate to remove the comment mark from the exclude array.

Impact

N/A

Testing

Added e2e test.

Screenshots/Video

N/A

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue preventing inline code formatting from being applied to previously-commented text. Comment formatting is now preserved alongside code formatting, allowing both styles to coexist on the same text selection.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
blocknote Error Error Jun 4, 2026 10:04am
blocknote-website Error Error Jun 4, 2026 10:04am

Request Review

@matthewlipski matthewlipski requested a review from nperez0111 June 4, 2026 09:23
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Code marks now allow comment marks to overlap by removing the comment mark from the exclusion list when the mark is created. A lifecycle hook filters the exclusion list conditionally, and an end-to-end test validates that comments and inline code coexist on the same text selection.

Changes

Code and Comment Mark Overlap

Layer / File(s) Summary
Mark exclusion lifecycle and type setup
packages/core/src/blocks/defaultBlocks.ts
MarkType is imported for type safety in the code mark's onBeforeCreate hook, which filters the comment mark from the code mark's excluded list, allowing the marks to coexist.
End-to-end test for mark overlap
tests/src/end-to-end/comments/comments.test.tsx
Test context is updated to import MOD constant, and a new test case verifies that inline code formatting is applied and the comment thread remains visible when code is toggled on previously-commented text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • nperez0111

Poem

A comment in the dark, a code mark so bright,
Now dancing together, a mark-overlap sight! 🐰✨
No more do they fight o'er the selfsame text,
Both styling in peace—what a markup context!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue #2803 concerns table indentation behavior, which is completely unrelated to the PR changes addressing comments overlapping inline code. Verify the correct issue is linked. The PR fixes issue #2803 per the description, but that issue describes table un-nesting problems, not comment-code overlap issues.
Title check ⚠️ Warning The title describes fixing inline code clearing comments, but the PR objectives show it actually fixes comments overlapping inline code—the opposite problem. The title is misleading about the core fix. Update the title to accurately reflect the fix: e.g., 'fix: Allow comments to overlap inline code (BLO-1207)' to match the actual implementation.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description covers Summary, Rationale, Changes, Impact, Testing, and Checklist sections, though Unit tests and documentation updates are unchecked and marked as not done.
Out of Scope Changes check ✅ Passed Changes are scoped to allowing comments to overlap inline code via onBeforeCreate hook and a corresponding e2e test, which directly addresses the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch comments-inline-code

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 and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2832

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2832

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2832

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2832

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2832

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2832

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2832

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2832

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2832

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2832

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2832

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2832

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2832

commit: 21c0866

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-2832/

Built to branch gh-pages at 2026-06-04 15:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@matthewlipski matthewlipski changed the title fix: Inline code clears comments (BLO-1211) fix: Inline code clears comments (BLO-1207) Jun 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.

Tables are hard to un-nest

1 participant