md2json2html
A npm package that transform markdown data to json and html.
Usage:
Install:
npm i md2json2html
Example:
See the test file.
const fs = ; const main = ;const markdown2json = mainmarkdown2json;const json2html = mainjson2html; const data = fs; const jsonRes = ;const htmlRes = ; console; console;
API:
markdown2json
/** * markdown to json * * @param * @return */
Note: the markdown-json node is defined as following:
{ thistagName = tagName; thisattr = attr; thischildren = children; }// example:// Node {// tagName: 'ul',// attr: {// // key-value pairs for ul// },// children: Node or Array of Node// }
See also test.json.
json2html
/** * json to html * * @param * @param * @return */
converters
is an array of function, the function's arguments as follows:
/** * sample converter * * @param * @return */ { // do something here.}
You can find a sample converter in test file. The converter using prismjs highlight the code area of node.
Thanks to mark-twain.