UNPKG

@bookbox/markup

Version:

Markup language for bookbox format

61 lines (50 loc) 741 B
# @bookbox/markup ``` npm i @bookbox/markup ``` ## API ```typescript 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} /* ```