Skip to content

refactor(Breaks): use new builder methods to register nodes - #1198

Merged
d3m1d0v merged 1 commit into
mainfrom
refactor-breaks
Aug 5, 2026
Merged

refactor(Breaks): use new builder methods to register nodes#1198
d3m1d0v merged 1 commit into
mainfrom
refactor-breaks

Conversation

@d3m1d0v

@d3m1d0v d3m1d0v commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

Refactor markdown break node registration to use the new builder APIs while preserving existing behavior.

Enhancements:

  • Switch hard and soft break nodes to be registered via addNodeSpec, addMarkdownTokenParserSpec, and addNodeSerializerSpec.
  • Update core and schema imports to use the new module alias paths.

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refactors hard and soft break extension configuration to use new builder methods for node specs, markdown token parsing, and node serialization, and updates imports to the new path aliases.

File-Level Changes

Change Details Files
Refactor hard and soft break node registration to use dedicated builder methods for specs, markdown parsing, and serialization.
  • Replace builder.addNode usage with builder.addNodeSpec for both HardBreak and SoftBreak nodes.
  • Register markdown token parsing via builder.addMarkdownTokenParserSpec for hardbreak and softbreak tokens.
  • Register node serialization via builder.addNodeSerializerSpec for HardBreak and SoftBreak nodes, preserving the previous serialization logic for consecutive breaks.
packages/editor/src/extensions/markdown/Breaks/BreaksSpecs/index.ts
Update imports to use new path aliases.
  • Change ExtensionAuto import from a relative path to the #core alias.
  • Change nodeTypeFactory import from a relative path to src/utils/schema.
packages/editor/src/extensions/markdown/Breaks/BreaksSpecs/index.ts

Possibly linked issues

  • #N/A: PR updates Breaks to new builder API, directly implementing the issue’s addNode/addMark removal item.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gravity-ui

gravity-ui Bot commented Aug 4, 2026

Copy link
Copy Markdown

Storybook Deployed

@gravity-ui

gravity-ui Bot commented Aug 4, 2026

Copy link
Copy Markdown

🎭 Playwright Report

@d3m1d0v
d3m1d0v marked this pull request as ready for review August 4, 2026 15:05
@d3m1d0v
d3m1d0v requested a review from makhnatkin as a code owner August 4, 2026 15:05

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The hard and soft break node specs share identical configuration (inline/group/marks/parseDOM/toDOM); consider extracting a small helper to avoid duplication and make future changes easier.
  • Now that builder methods are chained, double-check that the expected registration order (spec → markdown parser → serializer) matches the builder API’s assumptions, or document any required ordering to prevent subtle misuse in other extensions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hard and soft break node specs share identical configuration (inline/group/marks/parseDOM/toDOM); consider extracting a small helper to avoid duplication and make future changes easier.
- Now that builder methods are chained, double-check that the expected registration order (spec → markdown parser → serializer) matches the builder API’s assumptions, or document any required ordering to prevent subtle misuse in other extensions.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@d3m1d0v
d3m1d0v merged commit c12922c into main Aug 5, 2026
8 of 9 checks passed
@d3m1d0v
d3m1d0v deleted the refactor-breaks branch August 5, 2026 14:08
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