comark-keys
v0.11.0
Published
Keyboard keys in Comark: ++ctrl+shift+k++ renders each key as a <kbd>, with pymdownx.keys' names and aliases.
Maintainers
Readme
comark-keys
Keyboard shortcuts in Comark: ++ctrl+shift+k++ renders each key as a <kbd>, with the names and aliases of pymdownx.keys. A parse plugin with no components and no styles, so it works in any renderer.
pnpm add comark comark-keysimport { parseMarkdown } from "comark";
import keys from "comark-keys";
const document = await parseMarkdown(markdown, {
plugins: [keys()],
});Press ++ctrl+shift+k++ to search, ++cmd+opt+esc++ on a Mac, and ++shift+"Duck Button"++ for help.<span class="ckb"><kbd class="ckb-control">Ctrl</kbd><span>+</span><kbd class="ckb-shift">Shift</kbd><span>+</span><kbd class="ckb-k">K</kbd></span>Keys sit between ++ and ++, joined by +. Names aren't case sensitive and take pymdownx.keys' aliases, so ctrl reads Ctrl and pg-dn reads Page Down. A quoted key shows its own text. One unknown name leaves the whole shortcut as text, and so do C++, a++ b++, and comark-critic's {++insertion++}.
Options
| Option | |
| --- | --- |
| separator | What sits between two keys. Default "+"; "" puts nothing between them. |
| keys | More keys, or new names for built-in ones, by lowercase name: { hyper: "Hyper" }. |
Credits
The syntax, key names, and aliases are from pymdownx.keys by Isaac Muse, MIT.
