Every extension
ruby
Furigana · a reading printed above its base text.
`<ruby>漢字<rt>かんじ</rt></ruby>`. Japanese needs it wherever a reader may not know a kanji, and Chinese typesetting uses the same element for pinyin, so this is not a niche of a niche · it is how CJK text is annotated at all.
An atom, with the base as an attribute rather than as content. The obvious design is content plus an `rt` child, and it does not survive a paste: the parser walks every child element, and with no way to tell it which subtree is the content, the reading comes back inside the base as text — 漢字かんじ. The fix in ProseMirror is `contentElement`, which this parser does not have. So both halves are attributes, they round-trip exactly, and a caret can never end up inside an annotation.
The cost is that the base is not editable in place. `setRuby` replaces the node, which is what a furigana control does anyway.
Adding it
import { createEditor, document, paragraph, text, ruby } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, ruby],
element: document.querySelector('#editor'),
})
There is no separate package · ruby is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Commands
-
editor.commands.setRuby()
Attributes
-
base -
reading· defaults to""
HTML
-
Parses
ruby -
Renders
ruby