Skip to content

Build your personal knowledge base with Trilium Notes

1.6 KB
Raw Blame

Keyboard marker

Adds support for the keyboard input element (<kbd>) to CKEditor 5: a kbd text attribute, a kbd command, the Ctrl+Alt+K keystroke and a toolbar button.

Provenance

Derived from mlewand/ckeditor5-keyboard-marker by Marek Lewandowski, licensed GPL-3.0 — see LICENSE next to this file.

The source was ported to TypeScript and to current CKEditor 5 APIs, and has since diverged from upstream (two-step caret movement, spellcheck="false" on the editing-view element only, and copyOnEnter: false so the formatting does not carry onto the next paragraph). Upstream targets a long-obsolete CKEditor 5 version and is not tracked; treat this as Trilium-maintained code.

The conversion is split rather than two-way: the upcast matches any <kbd>, the data downcast emits a plain one, and only the editing downcast carries spellcheck="false". A two-way converter keyed on that attribute left a plain <kbd> — what docs/ and every Markdown import hold, since sanitizeHtml allows spellcheck on code but not on kbd — to General HTML Support, which drops it under the shipped empty allow-list.

It lived at packages/ckeditor5-keyboard-marker until it was folded into this package — it had no consumers outside @triliumnext/ckeditor5, was never published, and carried a full ckeditor5-package-generator scaffold (sample pages, its own ESLint/Stylelint/vitest configs) that nothing invoked. GPL-3.0 combines with this repository's AGPL-3.0-or-later license, so the split bought no license isolation either.