Press [[ctrl]] + [[c]]!
AST (see mdast specification)
For example, the following markdown:
[[ctrl]]
Yields:
{
type: 'kbd',
data: {
hName: 'kbd',
},
children: [{
type: 'text',
value: 'ctrl'
}]
}
This plugin is compatible with [rehype][https://github.com/rehypejs/rehype]. kbd
mdast nodes (e.g. [[ctrl]]
) will become <kbd>ctrl</kbd>
.
yarn add remark-kbd-simple
Dependencies:
const unified = require('unified')
const remarkParse = require('remark-parse')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')
const remarkKbd = require('remark-kbd-simple')
Usage:
unified()
.use(remarkParse)
.use(remarkKbd)
.use(remark2rehype)
.use(stringify)