wikiast-util-from-wikitext
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i wikiast-util-from-wikitext

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

3.62 kB

Total Files

7

Last publish

Collaborators

  • linonetwo012