Using mark-twain to convert markdown to jsonMl
npm i md2jsonml-core
const MT = require('md2jsonml-core');
const fs = require('fs');
const jsonML = MT(fs.readFileSync('readme.md','utf-8');
其返回值为 jsonMl
:
{
// YAML will be parsed as meta data.
meta: {
title: 'Title',
...
},
// Others will be parsed as JsonML.
content: [
"article",
["h1", "Here is a heading"],
[
"ol",
[
"li",
[
"p",
"First"
]
],
...
],
[
"p",
"This is a paragraph, including ",
[
"em",
"EM"
],
" and ",
[
"strong",
"STRONG"
],
". Any question? Oh, I almost forget ",
[
"code",
"inline code"
],
"."
],
...
]
}