1.0.1 • Published 3 years ago
remark-kbd-simple v1.0.1
remark-kbd-simple
Syntax
Press [[ctrl]] + [[c]]!AST (see mdast specification)
For example, the following markdown:
[[ctrl]]
Yields:
{
type: 'kbd',
data: {
hName: 'kbd',
},
children: [{
type: 'text',
value: 'ctrl'
}]
}Rehype
This plugin is compatible with rehype. kbd mdast nodes (e.g. [[ctrl]]) will become <kbd>ctrl</kbd>.
Installation
yarn add remark-kbd-simpleUsage
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)