1.0.3 • Published 5 years ago
mdast-util-to-bemjson v1.0.3
mdast-util-to-bemjson
Transforms MDAST tree to bemjson regarding to rules.
Requirements
Install
$ npm install mdast-util-to-bemjson
Usage
const unified = require('unified');
const markdown = require('remark-parse');
const toBemjson = require('mdast-util-to-bemjson');
const mdast = unified().use(markdown).parse('# Hello im _heading_');
const bjson = toBemjson(mdast);
console.log(JSON.stringify(bjson, null, 4));
Yields:
{
"block": "md-root",
"content": {
"block": "heading",
"mods": {
"level": 1
},
"level": 1,
"content": [
"Hello im ",
{
"block": "emphasis",
"content": "heading"
}
]
}
}
API
toBemjson(mdastTree[, options])
options
- Function augment — callback called on every node.
augment(bemNode):bemNode
. Important: Must return bemNode.
bemNode
- representation of bem entity (block, elem, mod, props)
License
Code and documentation copyright 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.6.1
6 years ago
0.5.0
6 years ago
0.5.0-canary.328750a
6 years ago
0.5.0-canary.cc1c85a
6 years ago
0.5.0-canary
6 years ago
0.4.0
6 years ago
0.4.0-alpha.a5125ef3
6 years ago
0.3.0
6 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.1
7 years ago