@wdprlib/render 0.1.5 → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @wdprlib/render
2
+
3
+ HTML renderer for Wikidot markup.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @wdprlib/render
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { parse } from "@wdprlib/parser";
15
+ import { renderToHtml } from "@wdprlib/render";
16
+ import type { PageContext, RenderOptions } from "@wdprlib/render";
17
+
18
+ const ast = parse("**Hello** world");
19
+
20
+ // Basic rendering
21
+ const html = renderToHtml(ast);
22
+
23
+ // With page context and resolvers
24
+ const pageContext: PageContext = {
25
+ pageName: "main",
26
+ site: "mysite",
27
+ domain: "mysite.example.com",
28
+ pageExists: (name) => checkPageExists(name),
29
+ };
30
+
31
+ const html = renderToHtml(ast, {
32
+ page: pageContext,
33
+ footnotes: ast.footnotes,
34
+ resolvers: {
35
+ user: (username) => ({ name: username, displayName: "Display Name" }),
36
+ htmlBlockUrl: (index) => `/local--html/page/${index}`,
37
+ },
38
+ });
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - HTML generation from AST
44
+ - Footnote and bibliography rendering
45
+ - User link resolution
46
+ - Embed block with configurable allowlist
47
+ - Math rendering (via Temml)
48
+ - XSS protection (via DOMPurify)
49
+
50
+ ## Related Packages
51
+
52
+ - [@wdprlib/ast](https://www.npmjs.com/package/@wdprlib/ast) - AST type definitions
53
+ - [@wdprlib/parser](https://www.npmjs.com/package/@wdprlib/parser) - Wikidot markup parser
54
+ - [@wdprlib/runtime](https://www.npmjs.com/package/@wdprlib/runtime) - Client-side runtime
55
+
56
+ ## License
57
+
58
+ AGPL-3.0 - See [LICENSE](https://github.com/r74tech/wdpr/blob/develop/LICENSE)