Need private packages and team management tools?Check out npm Teams »

remark-kbd

1.0.21 • Public • Published

remark-kbd Build Status Coverage Status

This plugin parses custom Markdown syntax to handle keyboard keys. It adds a new node type to the mdast produced by remark: kbd

If you are using rehype, the stringified HTML result will be <kbd>.

Syntax

Hit ||enter|| twice to create a new paragraph.

AST (see mdast specification)

Kbd (Parent) represents a reference to a user.

interface Kbd <: Parent {
  type: "kbd";
}

For example, the following markdown:

||enter||

Yields:

{
  type: 'kbd',
  children: [{
    type: 'text',
    value: 'enter'
  }]
}

Rehype

This plugin is compatible with rehype. Kbd mdast nodes will become <kbd>contents</kbd>.

Installation

npm:

npm install remark-kbd

Usage

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')

Usage:

unified()
  .use(remarkParse)
  .use(remarkKbd)
  .use(remark2rehype)
  .use(stringify)

License

MIT © Zeste de Savoir

Keywords

Install

npm i remark-kbd

DownloadsWeekly Downloads

179

Version

1.0.21

License

MIT

Unpacked Size

7.65 kB

Total Files

5

Last publish

Collaborators

  • avatar
  • avatar