Skip to content

FEATURE: Support all bbcode tags in the rich editor - #107

Open
renato wants to merge 1 commit into
mainfrom
rich-editor-extension
Open

FEATURE: Support all bbcode tags in the rich editor#107
renato wants to merge 1 commit into
mainfrom
rich-editor-extension

Conversation

@renato

@renato renato commented Aug 3, 2026

Copy link
Copy Markdown

Previously, opening a post that used any of this plugin's bbcode tags ([color], [size], [left], [list=a], etc.) in the rich text editor failed with "The rich text editor doesn't support all features used in this post" and forced the markdown editor.

This change adds a rich editor extension that parses and serializes every tag the plugin supports — inline styling as marks, alignment/indent/[ot]/[edit] as block nodes, and typed [list=X] lists — so bbcode posts open in the rich editor and keep cooking to the same output.

List items are now parsed as blocks rather than as a single inline token, so an item can hold nested lists and multiple paragraphs, and [*] and [li] markers can be mixed in one list. Cooked sepquotes carry a data-tag, so [ot] and [edit] are told apart structurally instead of by their localized label.

Two things to note:

  • The source is normalized on a round trip: tags are lowercased, [li] items become [*], untyped [list]/[ul]/[ol] become markdown lists, a same-type tag nested in one with the same value drops out, and attribute quoting is canonicalized. Editing a bbcode post in the rich editor rewrites its source accordingly.
  • Content the editor can't represent exactly is declined instead, leaving the post to the markdown editor with its source intact: tag values outside the charsets the cook sanitizer allows, and a same-type tag nested in one with a differing value, since a mark set holds one mark per type and nested [size] percentages compound when cooked.

@ZogStriP ZogStriP left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💅

Opening a post that used any of this plugin's tags ([color], [size],
[left], [list=a], etc.) in the rich text editor failed with "The rich
text editor doesn't support all features used in this post" and forced
the markdown editor.

Add a rich editor extension covering every tag the plugin supports:
inline styling as marks, alignment, [indent], [ot] and [edit] as block
nodes, and typed [list=X] lists. A tag value is only accepted when it
matches the charsets the cook sanitizer allows, so the editor can't show
styling the rendered post drops, and a value can't carry extra style
declarations into the editor's DOM.

Content the editor can't represent exactly is declined rather than
rewritten, leaving the post to the markdown editor with its source
intact: values outside those charsets, and a same-type tag nested in one
with a differing value, since a mark set holds one mark per type and
nested [size] percentages compound when cooked.

Cooking changes with it, without changing what a post renders as. Cooked
sepquotes carry a data-tag, so [ot] and [edit] are told apart
structurally instead of by their localized label, which no longer works
once a post is read under another locale. Typed lists get their own token
type and every item's content is wrapped in hidden paragraph tokens,
which render as nothing but let prosemirror-markdown's own list specs
parse them.
@renato
renato force-pushed the rich-editor-extension branch from 7f0de84 to 407dff7 Compare August 5, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants