Client-side runtime for Wikidot markup.
bun add @wdprlib/runtimeimport { initWdprRuntime } from "@wdprlib/runtime";
import type { WdprRuntime, RuntimeOptions } from "@wdprlib/runtime";
// Initialize after DOM is ready
const runtime: WdprRuntime = initWdprRuntime({
root: document.getElementById("page-content") as HTMLElement,
onRate: async (ref, action) => {
const res = await fetch("/api/rate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ page_id: currentPageId, ref, action }),
});
if (!res.ok) throw new Error("Vote submission failed");
return res.json();
},
});
// Cleanup when navigating away or re-rendering
runtime.destroy();Workers that only serve HTML block iframe content can import the resize script without loading the browser runtime or its DOM types:
import { HTML_BLOCK_RESIZE_SCRIPT } from "@wdprlib/runtime/html-block-script";The existing root import remains available for browser applications.
- Tabview tab switching
- Collapsible block toggle
- Table of contents navigation
- Footnote / bibliography interactions
- Foldable list toggle
- Responsive gallery layout and lightbox navigation
- Math rendering (MathML with SVG polyfill via hfmath)
- Rating module callbacks
- Date formatting (odate)
- Email obfuscation reveal
- @wdprlib/ast - AST type definitions
- @wdprlib/parser - Wikidot markup parser
- @wdprlib/render - HTML renderer
- @wdprlib/decompiler - HTML to Wikidot decompiler
AGPL-3.0 - See LICENSE