md2json2html

A npm package that transform markdown data to json and html.
Usage:
Install:
npm i md2json2html
Example:
See the test file.
const fs = require('fs');
const main = require('md2json2html');
const markdown2json = main.markdown2json;
const json2html = main.json2html;
const data = fs.readFileSync(__dirname + '/test.md', 'utf8');
const jsonRes = markdown2json(data);
const htmlRes = json2html(jsonRes.content);
console.log(JSON.stringify(jsonRes, null, 4));
console.log(htmlRes);
API:
markdown2json
Note: the markdown-json node is defined as following:
class Node {
constructor(tagName, attr, children) {
this.tagName = {
attr,
children
}
}
}
json2html
Thanks to mark-twain.