Skip to content
This repository has been archived by the owner on Nov 13, 2017. It is now read-only.

birhoff/remark-bemjson

Repository files navigation

remark-bemjson

Compile markdown to BEMJSON with remark.

NPM Status Travis Status Coverage Status Dependency Status Greenkeeper badge

Requirements

Install

$ npm install remark-bemjson

Usage

const remark = require('remark');
const bemjson = require('remark-bemjson');

const file = remark().use(bemjson).processSync('# Hello im _heading_');

console.log(String(file));

Yields:

{
  "block": "documentation",
  "content": {
    "block": "heading",
    "mods": {
      "level": 1
    },
    "content": [
      "Hello im ",
      {
        "block": "emphasis",
        "content": "heading"
      }
    ]
  }
}

API

remark.use(bemjson[, options])

options

string exportType - determinate how to export bemjson. Default: commonJS
Value Description
commonJS Exports to CJS.
modules Exports to ES6 modules. Optional combines with exportName.
umd Exports to UMD with umd package. Requires exportName.
YModules Exports to YModules. Requires exportName.
no export Don't do any export. Just plain JSON.stringify.
string exportName - export bemjson with given name when use modules, umd or YModules.
boolean export - if false don't generate export. Default: true
Function augment - callback called on every node. Signature. Option passed to mdast-util-to-bemjson.

License

Code and documentation copyright 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.