Skip to content

fix: Restrict auto list conversion to paragraphs #1729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Mulgyeol
Copy link

Description

When users type list markers ("1." or "-/+/*") at the beginning of a block, BlockNote automatically converts it into a list.
Previously, this conversion would trigger in any block with inline content, including headings and custom blocks.
This was disruptive when users wanted to start headings or other blocks with numbers or list markers.

This change restricts the auto-conversion to list blocks to paragraph blocks only,
preserving these inputs in other block types as plain text.

Fixes #1710

Changes

  • Modified the input rule condition in NumberedListItemBlockContent.ts to check for paragraph blocks specifically
  • Modified the input rule condition in BulletListItemBlockContent.ts to check for paragraph blocks specifically

Testing

The following scenarios should be tested:

  1. In a heading block:

    • Type "1." at the start
    • Expected: Text remains as "1." without converting to a numbered list
    • Type "-" or "+" at the start
    • Expected: Text remains as is without converting to a bullet list
  2. In a paragraph block:

    • Type "1." at the start
    • Expected: Block converts to a numbered list item
    • Type "-" or "+" at the start
    • Expected: Block converts to a bullet list item
  3. In a custom block (like alert block):

    • Type "1." or list markers (-/+/*)
    • Expected: Text remains as is without converting to any type of list

Mulgyeol added 2 commits May 30, 2025 16:27
Previously, typing "1." would convert any block with inline content into a numbered list,
which was disruptive when users wanted to start headings or other blocks with numbers.

Now, the auto-conversion to numbered list only triggers in paragraph blocks,
preserving numerical inputs in other block types as plain text.
Previously, typing list markers (-/+/*) would convert any block with inline content into a bullet list,
which was disruptive when users wanted to start headings or other blocks with these markers.

Now, the auto-conversion to bullet list only triggers in paragraph blocks,
preserving list markers in other block types as plain text.
Copy link

vercel bot commented May 30, 2025

@Mulgyeol is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@Mulgyeol Mulgyeol changed the title Fix/restrict auto list conversion to paragraphs fix/restrict auto list conversion to paragraphs May 30, 2025
@Mulgyeol Mulgyeol changed the title fix/restrict auto list conversion to paragraphs fix: Restrict auto list conversion to paragraphs May 30, 2025
@nperez0111
Copy link
Contributor

@Mulgyeol this might also be an issue for people using custom blocks who want that automatic conversion.

I suggest instead to disallow the conversion in elements we know we don't want it in: headings for example.

Or, to somehow flag which elements should have this behavior or not with something like the group they are apart of

Instead of restricting auto list conversion to paragraph blocks only,
revert to allowing it in all blocks except headings. This provides better
flexibility while still preventing unwanted conversions in heading blocks
where users often need to start with numbers.

Future improvements:
- Add configurable flags for controlling auto list conversion behavior
- Allow users to customize this behavior for their custom blocks
- Consider adding a more generic solution for controlling input rule behaviors
@Mulgyeol
Copy link
Author

Thanks for the feedback! @nperez0111

Yeah, I see your point — restricting auto-conversion in non-paragraph blocks might cause inconvenience for users who expect that feature.
So, I reverted the previous approach and now restrict auto list conversion only in heading blocks, allowing it for other block types for more flexibility.

I figured that heading blocks are explicitly intended for titles, and users starting with "1." or "-" in those contexts are typically not trying to create a listso this felt like a safe and targeted change to apply directly.

As a follow-up, I'd love to explore adding a more flexible system using flags or metadata per block type, so custom blocks can opt in or out of this behavior explicitly. I'll look into contributing that in a future PR!

Let me know if you have further thoughts!

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.

Typing 1. or + and hitting space changes block type.
2 participants