@functional-examples/documentation 0.0.0-alpha.1 → 0.0.0-alpha.2
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 +61 -0
- package/README.md.template +61 -0
- package/package.json +7 -6
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @functional-examples/documentation
|
|
2
|
+
|
|
3
|
+
Documentation generation plugin for functional-examples.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @functional-examples/documentation
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This plugin generates documentation from your scanned examples using customizable templates. It supports both Markdown and Markdoc output formats, with Eta-powered template rendering.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { createDocumentationPlugin } from '@functional-examples/documentation';
|
|
19
|
+
import type { Config } from 'functional-examples';
|
|
20
|
+
|
|
21
|
+
const config: Config = {
|
|
22
|
+
plugins: [
|
|
23
|
+
createDocumentationPlugin({
|
|
24
|
+
outputDir: './docs/examples',
|
|
25
|
+
format: 'markdown',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default config;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Template-based generation**: Eta templates for full control over output
|
|
36
|
+
- **Per-example templates**: Override the template for specific examples
|
|
37
|
+
- **Prose file rendering**: README.md files in examples are rendered with helper expansion
|
|
38
|
+
- **Region references**: Use `file()` and `region()` helpers in prose to embed code
|
|
39
|
+
- **Guide hydration**: Expand cross-example references in standalone guide documents
|
|
40
|
+
- **Check mode**: CI-friendly `--check` flag to verify docs are up-to-date
|
|
41
|
+
- **Multiple formats**: Markdown and Markdoc output
|
|
42
|
+
|
|
43
|
+
## Template Helpers
|
|
44
|
+
|
|
45
|
+
Inside prose files (README.md in examples), use:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
<%= file('utils.ts') %> <% /* Embed a file as a fenced code block */ %>
|
|
49
|
+
<%= region('setup') %> <% /* Embed a code region */ %>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Inside guide documents, reference any example:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
<%= example('basic-usage').file('scan.ts') %>
|
|
56
|
+
<%= example('basic-usage').region('config-setup') %>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @functional-examples/documentation
|
|
2
|
+
|
|
3
|
+
Documentation generation plugin for functional-examples.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @functional-examples/documentation
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This plugin generates documentation from your scanned examples using customizable templates. It supports both Markdown and Markdoc output formats, with Eta-powered template rendering.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { createDocumentationPlugin } from '@functional-examples/documentation';
|
|
19
|
+
import type { Config } from 'functional-examples';
|
|
20
|
+
|
|
21
|
+
const config: Config = {
|
|
22
|
+
plugins: [
|
|
23
|
+
createDocumentationPlugin({
|
|
24
|
+
outputDir: './docs/examples',
|
|
25
|
+
format: 'markdown',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default config;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Template-based generation**: Eta templates for full control over output
|
|
36
|
+
- **Per-example templates**: Override the template for specific examples
|
|
37
|
+
- **Prose file rendering**: README.md files in examples are rendered with helper expansion
|
|
38
|
+
- **Region references**: Use `file()` and `region()` helpers in prose to embed code
|
|
39
|
+
- **Guide hydration**: Expand cross-example references in standalone guide documents
|
|
40
|
+
- **Check mode**: CI-friendly `--check` flag to verify docs are up-to-date
|
|
41
|
+
- **Multiple formats**: Markdown and Markdoc output
|
|
42
|
+
|
|
43
|
+
## Template Helpers
|
|
44
|
+
|
|
45
|
+
Inside prose files (README.md in examples), use:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
<\%= file('utils.ts') \%> <\% /* Embed a file as a fenced code block */ \%>
|
|
49
|
+
<\%= region('setup') \%> <\% /* Embed a code region */ \%>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Inside guide documents, reference any example:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
<\%= example('basic-usage').file('scan.ts') \%>
|
|
56
|
+
<\%= example('basic-usage').region('config-setup') \%>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functional-examples/documentation",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Documentation generation plugin for functional-examples",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"templates"
|
|
21
21
|
],
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"functional-examples": "0.0.0-alpha.
|
|
23
|
+
"functional-examples": "0.0.0-alpha.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependenciesMeta": {
|
|
26
26
|
"yaml": {
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"cli-forge": "1.2.0",
|
|
32
32
|
"eta": "^3.5.0",
|
|
33
33
|
"zod": "4.3.6",
|
|
34
|
-
"@functional-examples/devkit": "0.0.0-alpha.
|
|
34
|
+
"@functional-examples/devkit": "0.0.0-alpha.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.19.8",
|
|
38
38
|
"typescript": "^5.7.2",
|
|
39
39
|
"vitest": "^1.3.1",
|
|
40
40
|
"yaml": "^2.7.1",
|
|
41
|
-
"@functional-examples/devkit": "0.0.0-alpha.
|
|
42
|
-
"functional-examples": "0.0.0-alpha.
|
|
41
|
+
"@functional-examples/devkit": "0.0.0-alpha.2",
|
|
42
|
+
"functional-examples": "0.0.0-alpha.2"
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"author": {
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc -p tsconfig.lib.json",
|
|
59
59
|
"test": "vitest run",
|
|
60
|
-
"test:watch": "vitest"
|
|
60
|
+
"test:watch": "vitest",
|
|
61
|
+
"extract-docs": "typedoc --options typedoc.json"
|
|
61
62
|
}
|
|
62
63
|
}
|