remark-code-blocks
Remark plugin to extract
code
nodes from markdown.
Install
npm i -S remark-code-blocks
Usage
const toVfile = const unified = const parser = const stringify = const codeblocks =
or use the standalone function which takes a tree as its first argument.
const toVfile = const unified = const parser = const codeblocks = const tree = const code =
API
.use(codeblocks[, options])
Use as a plugin to extract code nodes.
The results are stored in file.data
in a codeblocks
property by default. You can override the name of the property using options.name
.
.codeblocks(tree[, options])
Also exports a standalone function.
Options
lang
Type: string
Default: all
Specify a language and only extract code nodes with that language. Otherwise all
code nodes are extracted.
name
Type: string
Default: codeblocks
Specify the name of the property in file.data
formatter
Type: function
Default: none
Add a function to run over the nodes values before storing them in file.data
License
MIT © Paul Zimmer