Skip to content

Commit 265d8a8

Browse files
committed
chore: バージョンを 1.0.0-rc.0 に更新し README を追加
1 parent 0174950 commit 265d8a8

File tree

9 files changed

+225
-8
lines changed

9 files changed

+225
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Wikidot markup parser and renderer.
66

77
| Package | Description |
88
|---------|-------------|
9-
| [@wdprlib/ast](./packages/ast) | AST type definitions |
10-
| [@wdprlib/parser](./packages/parser) | Wikidot markup parser |
11-
| [@wdprlib/render](./packages/render) | HTML renderer |
12-
| [@wdprlib/runtime](./packages/runtime) | Client-side runtime for interactive elements |
9+
| [@wdprlib/ast](./packages/ast) | AST types for Wikidot markup |
10+
| [@wdprlib/parser](./packages/parser) | Parser for Wikidot markup |
11+
| [@wdprlib/render](./packages/render) | HTML renderer for Wikidot markup |
12+
| [@wdprlib/runtime](./packages/runtime) | Client-side runtime for Wikidot markup |
1313

1414
## Installation
1515

packages/ast/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# @wdprlib/ast
2+
3+
AST type definitions for Wikidot markup.
4+
5+
## Installation
6+
7+
```bash
8+
bun add @wdprlib/ast
9+
```
10+
11+
## Usage
12+
13+
```ts
14+
import type { SyntaxTree, Element } from '@wdprlib/ast'
15+
import { text, paragraph, bold } from '@wdprlib/ast'
16+
17+
// Create AST nodes
18+
const tree: SyntaxTree = {
19+
elements: [
20+
paragraph([
21+
bold([text('Hello')]),
22+
text(' world'),
23+
]),
24+
],
25+
}
26+
```
27+
28+
## Exports
29+
30+
Types: `SyntaxTree`, `Element`, `ElementName`, `ContainerType`, `AttributeMap`, `LinkType`, `ListType`, `Module`, etc.
31+
32+
Helpers: `text`, `paragraph`, `bold`, `italics`, `heading`, `link`, `list`, `lineBreak`, `horizontalRule`
33+
34+
## Related Packages
35+
36+
- [@wdprlib/parser](https://www.npmjs.com/package/@wdprlib/parser) - Wikidot markup parser
37+
- [@wdprlib/render](https://www.npmjs.com/package/@wdprlib/render) - HTML renderer
38+
- [@wdprlib/runtime](https://www.npmjs.com/package/@wdprlib/runtime) - Client-side runtime
39+
40+
## License
41+
42+
AGPL-3.0 - See [LICENSE](https://github.com/r74tech/wdpr/blob/develop/LICENSE)

packages/ast/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdprlib/ast",
3-
"version": "0.1.5",
3+
"version": "1.0.0-rc.0",
44
"description": "AST types for Wikidot markup",
55
"keywords": [
66
"ast",

packages/parser/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# @wdprlib/parser
2+
3+
Wikidot markup parser.
4+
5+
## Installation
6+
7+
```bash
8+
bun add @wdprlib/parser
9+
```
10+
11+
## Usage
12+
13+
```ts
14+
import { parse, resolveIncludes, extractDataRequirements, resolveModules } from '@wdprlib/parser'
15+
import type { SyntaxTree, PageRef } from '@wdprlib/parser'
16+
17+
// Basic parsing
18+
const tree: SyntaxTree = parse('**Hello** world')
19+
20+
// Full pipeline with includes and modules
21+
const source = '[[include component:box]]\n[[module ListPages]]\n%%title%%\n[[/module]]'
22+
23+
// 1. Resolve includes
24+
const expanded = resolveIncludes(source, (ref: PageRef) => {
25+
return getPageSource(ref.page) // your function to fetch page source
26+
})
27+
28+
// 2. Parse
29+
const ast = parse(expanded)
30+
31+
// 3. Extract data requirements for modules
32+
const { requirements, compiledListPagesTemplates } = extractDataRequirements(ast)
33+
34+
// 4. Resolve modules with external data
35+
const resolved = await resolveModules(ast, {
36+
fetchListPages: async (query) => {
37+
// Fetch pages matching query from your database
38+
return { pages: [...], totalCount: 100, site: { name: 'mysite' } }
39+
},
40+
getPageTags: () => ['tag1', 'tag2'],
41+
}, {
42+
parse,
43+
compiledListPagesTemplates,
44+
requirements,
45+
})
46+
```
47+
48+
## Features
49+
50+
- Wikidot markup parsing (bold, italic, links, images, tables, etc.)
51+
- Include resolution (`[[include page]]`)
52+
- Module support (ListPages, ListUsers, IfTags, etc.)
53+
- Data extraction for server-side rendering
54+
55+
## Related Packages
56+
57+
- [@wdprlib/ast](https://www.npmjs.com/package/@wdprlib/ast) - AST type definitions
58+
- [@wdprlib/render](https://www.npmjs.com/package/@wdprlib/render) - HTML renderer
59+
- [@wdprlib/runtime](https://www.npmjs.com/package/@wdprlib/runtime) - Client-side runtime
60+
61+
## License
62+
63+
AGPL-3.0 - See [LICENSE](https://github.com/r74tech/wdpr/blob/develop/LICENSE)

packages/parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdprlib/parser",
3-
"version": "0.1.5",
3+
"version": "1.0.0-rc.0",
44
"description": "Parser for Wikidot markup",
55
"keywords": [
66
"ast",

packages/render/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

packages/render/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdprlib/render",
3-
"version": "0.1.5",
3+
"version": "1.0.0-rc.0",
44
"description": "HTML renderer for Wikidot markup",
55
"keywords": [
66
"html",

packages/runtime/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# @wdprlib/runtime
2+
3+
Client-side runtime for interactive Wikidot elements.
4+
5+
## Installation
6+
7+
```bash
8+
bun add @wdprlib/runtime
9+
```
10+
11+
## Usage
12+
13+
```ts
14+
import { initWdprRuntime } from '@wdprlib/runtime'
15+
import type { WdprRuntime, RuntimeOptions } from '@wdprlib/runtime'
16+
17+
// Initialize after DOM is ready
18+
const runtime: WdprRuntime = initWdprRuntime({
19+
root: document.getElementById('page-content') as HTMLElement,
20+
onRate: async (pageId, points) => {
21+
const res = await fetch('/api/rate', {
22+
method: 'POST',
23+
headers: { 'Content-Type': 'application/json' },
24+
body: JSON.stringify({ page_id: pageId, points }),
25+
})
26+
return res.json()
27+
},
28+
})
29+
30+
// Cleanup when navigating away or re-rendering
31+
runtime.destroy()
32+
```
33+
34+
## Features
35+
36+
- Tabview tab switching
37+
- Collapsible block toggle
38+
- Table of contents navigation
39+
- Footnote / bibliography interactions
40+
- Foldable list toggle
41+
- Math rendering (MathML with SVG polyfill via hfmath)
42+
- Rating module callbacks
43+
- Date formatting (odate)
44+
- Email obfuscation reveal
45+
46+
## Related Packages
47+
48+
- [@wdprlib/ast](https://www.npmjs.com/package/@wdprlib/ast) - AST type definitions
49+
- [@wdprlib/parser](https://www.npmjs.com/package/@wdprlib/parser) - Wikidot markup parser
50+
- [@wdprlib/render](https://www.npmjs.com/package/@wdprlib/render) - HTML renderer
51+
52+
## License
53+
54+
AGPL-3.0 - See [LICENSE](https://github.com/r74tech/wdpr/blob/develop/LICENSE)

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdprlib/runtime",
3-
"version": "0.1.5",
3+
"version": "1.0.0-rc.0",
44
"description": "Client-side runtime for Wikidot markup",
55
"keywords": [
66
"markup",

0 commit comments

Comments
 (0)