@bookbox/markup
v0.4.0
Published
Markup language for bookbox format
Downloads
10
Readme
@bookbox/markup
npm i @bookbox/markup
API
import { parse, stringify } from '@bookbox/markup';
const text = `
just string
{a.href{ya.ru} ya}
`;
const ast = parse(text); // type Body
/*
{
"blocks": [
{
"text": "\njust string\n\n"
},
{
"tag": {
"name": "a",
"body": {
"blocks": [
{
"text": "ya"
}
]
},
"attrList": [
{
"name": "href",
"value": "ya.ru",
"empty": false
}
],
"separator": " "
}
},
{
"text": "\n"
}
]
}
*/
const text_copy = stringify(ast);
/*
just string
{a.href{ya.ru} ya}
/*