Decompiler for Wikidot markup.
bun add @wdprlib/decompiler
import { decompile } from "@wdprlib/decompiler";
// HTML → Wikidot syntax
const wikidot = decompile("<p><strong>Hello</strong> world</p>");
// => "**Hello** world"
import { htmlToAst, serialize } from "@wdprlib/decompiler";
// 1. HTML → AST
const tree = htmlToAst("<p>Hello</p>");
// 2. Inspect or transform the AST...
// 3. AST → Wikidot syntax
const wikidot = serialize(tree);
decompile(html, options?)Converts HTML to Wikidot syntax in one call (HTML → AST → serialize).
htmlToAst(html, options?)Converts HTML to a Wikidot AST (SyntaxTree). Footnote content is extracted and stored in tree.footnotes.
serialize(tree, options?)Converts a Wikidot AST to markup text.
[[module ...]]), includes, iftags, comments are out of scopeAGPL-3.0 - See LICENSE