toolcraft 0.0.75 → 0.0.76
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.
|
@@ -11,10 +11,30 @@ npm install toolcraft-design
|
|
|
11
11
|
Import from the package root:
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
configureTheme,
|
|
16
|
+
promptText,
|
|
17
|
+
renderMarkdown,
|
|
18
|
+
renderMarkdownHtml,
|
|
19
|
+
renderTable,
|
|
20
|
+
text
|
|
21
|
+
} from "toolcraft-design";
|
|
15
22
|
```
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
Flat subpath imports are also public package exports. Use the kebab-case file name that matches the root export name:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { renderMarkdownHtml } from "toolcraft-design/render-markdown-html";
|
|
28
|
+
import { renderTable } from "toolcraft-design/render-table";
|
|
29
|
+
import { renderDetailCard } from "toolcraft-design/render-detail-card";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Consumers using the bundled Toolcraft design entrypoint can use the same exports through `toolcraft`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { renderMarkdownHtml } from "toolcraft/design";
|
|
36
|
+
import { renderTable } from "toolcraft/design/render-table";
|
|
37
|
+
```
|
|
18
38
|
|
|
19
39
|
## Public API
|
|
20
40
|
|
|
@@ -68,7 +88,31 @@ The package does not expose public subpath imports.
|
|
|
68
88
|
- `parse`: parses Markdown into `MdNode` values.
|
|
69
89
|
- `render`: renders parsed Markdown nodes for the terminal.
|
|
70
90
|
- `renderMarkdown`: parses and renders a Markdown string.
|
|
71
|
-
-
|
|
91
|
+
- `renderHtml`: renders parsed Markdown nodes as safe HTML fragments.
|
|
92
|
+
- `renderMarkdownHtml`: parses and renders a Markdown string as a safe HTML fragment.
|
|
93
|
+
- Types: `MdNode`, `RenderOptions`, `HtmlRenderOptions`.
|
|
94
|
+
|
|
95
|
+
Terminal rendering and HTML rendering share the same parser and AST:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { parse, render, renderHtml, renderMarkdownHtml } from "toolcraft-design";
|
|
99
|
+
|
|
100
|
+
const markdown = "# Status\n\nUse `poe-code configure`.";
|
|
101
|
+
const { ast } = parse(markdown);
|
|
102
|
+
|
|
103
|
+
console.log(render(ast));
|
|
104
|
+
console.log(renderHtml(ast));
|
|
105
|
+
console.log(renderMarkdownHtml(markdown));
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
HTML output is a fragment, not a full HTML document:
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<h1>Status</h1>
|
|
112
|
+
<p>Use <code>poe-code configure</code>.</p>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Raw HTML in Markdown is escaped by default. Pass `{ allowRawHtml: true }` only when the input is trusted.
|
|
72
116
|
|
|
73
117
|
### Static Rendering
|
|
74
118
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"toolcraft-schema": "0.0.
|
|
54
|
+
"toolcraft-schema": "0.0.76",
|
|
55
55
|
"commander": "^13.1.0",
|
|
56
56
|
"fast-string-width": "^3.0.2",
|
|
57
57
|
"fast-wrap-ansi": "^0.2.0",
|