@bookbox/markup
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

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

/*

Package Sidebar

Install

npm i @bookbox/markup

Weekly Downloads

2

Version

0.5.0

License

MIT

Unpacked Size

101 kB

Total Files

17

Last publish

Collaborators

  • nikalex