0.4.0 • Published 9 months ago

@bookbox/markup v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@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}

/*
0.3.0

9 months ago

0.2.0

9 months ago

0.4.0

9 months ago

0.1.0

10 months ago