Client-side runtime for Wikidot markup.
bun add @wdprlib/runtime
import { 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 (pageId, points) => {
const res = await fetch("/api/rate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ page_id: pageId, points }),
});
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.
AGPL-3.0 - See LICENSE