0.3.0 • Published 11 months ago

wikiast-util-from-wikitext v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

wikiast-util-from-wikitext

This package simply calling $tw.wiki.parseText.

This mainly contains test for this function.

Usage

import { wikiAstFromWikiText } from "wikiast-util-from-wikitext";

const ast = wikiAstFromWikiText("AAA");
// with position info
expect(ast).toEqual([
  {
    type: "element",
    tag: "p",
    children: [{ type: "text" as const, text: "AAA", start: 0, end: 3 }],
    start: 0,
    end: 3,
  },
]);

Or just as simple as

const ast = $tw.wiki.parseText("text/vnd.tiddlywiki", "AAA").tree;

See more examples in the test folder.

0.3.0

11 months ago

0.2.0

11 months ago