toolcraft 0.0.79 → 0.0.80

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.
@@ -114,6 +114,132 @@ HTML output is a fragment, not a full HTML document:
114
114
 
115
115
  Raw HTML in Markdown is escaped by default. Pass `{ allowRawHtml: true }` only when the input is trusted.
116
116
 
117
+ #### Syntax highlighting
118
+
119
+ Fenced code block syntax highlighting is opt-in:
120
+
121
+ ```ts
122
+ import { renderMarkdown, renderMarkdownHtml } from "toolcraft-design";
123
+
124
+ const html = renderMarkdownHtml("```ts\nconst value = \"hello\";\n```", {
125
+ syntaxHighlight: true
126
+ });
127
+ const terminal = renderMarkdown("```ts\nconst value = \"hello\";\n```", {
128
+ syntaxHighlight: true
129
+ });
130
+ ```
131
+
132
+ HTML highlighting emits escaped code text with neutral Toolcraft-owned `<span>` wrappers. The renderer does not ship or inject CSS, so consumers control the appearance:
133
+
134
+ ```html
135
+ <pre><code class="language-ts"><span class="tc-token-keyword">const</span> value = <span class="tc-token-string">&quot;hello&quot;</span>;</code></pre>
136
+ ```
137
+
138
+ Starter CSS:
139
+
140
+ ```css
141
+ .tc-token-keyword,
142
+ .tc-token-type,
143
+ .tc-token-tag,
144
+ .tc-token-command,
145
+ .tc-token-decorator,
146
+ .tc-token-directive,
147
+ .tc-token-at-rule {
148
+ color: var(--code-keyword);
149
+ font-weight: 700;
150
+ }
151
+
152
+ .tc-token-string,
153
+ .tc-token-template {
154
+ color: var(--code-string);
155
+ }
156
+
157
+ .tc-token-comment {
158
+ color: var(--code-comment);
159
+ font-style: italic;
160
+ }
161
+
162
+ .tc-token-number,
163
+ .tc-token-boolean,
164
+ .tc-token-null,
165
+ .tc-token-parameter {
166
+ color: var(--code-number);
167
+ }
168
+
169
+ .tc-token-key,
170
+ .tc-token-property,
171
+ .tc-token-attribute,
172
+ .tc-token-variable,
173
+ .tc-token-function,
174
+ .tc-token-anchor,
175
+ .tc-token-label {
176
+ color: var(--code-symbol);
177
+ }
178
+
179
+ .tc-token-regex,
180
+ .tc-token-color,
181
+ .tc-token-important,
182
+ .tc-token-flag,
183
+ .tc-token-invalid {
184
+ color: var(--code-warning);
185
+ }
186
+
187
+ .tc-token-operator,
188
+ .tc-token-punctuation,
189
+ .tc-token-selector {
190
+ color: var(--code-muted);
191
+ }
192
+ ```
193
+
194
+ Available token classes:
195
+
196
+ - `.tc-token-anchor`
197
+ - `.tc-token-at-rule`
198
+ - `.tc-token-attribute`
199
+ - `.tc-token-boolean`
200
+ - `.tc-token-color`
201
+ - `.tc-token-command`
202
+ - `.tc-token-comment`
203
+ - `.tc-token-decorator`
204
+ - `.tc-token-directive`
205
+ - `.tc-token-flag`
206
+ - `.tc-token-function`
207
+ - `.tc-token-identifier`
208
+ - `.tc-token-important`
209
+ - `.tc-token-invalid`
210
+ - `.tc-token-key`
211
+ - `.tc-token-keyword`
212
+ - `.tc-token-label`
213
+ - `.tc-token-null`
214
+ - `.tc-token-number`
215
+ - `.tc-token-operator`
216
+ - `.tc-token-parameter`
217
+ - `.tc-token-plain`
218
+ - `.tc-token-property`
219
+ - `.tc-token-punctuation`
220
+ - `.tc-token-regex`
221
+ - `.tc-token-selector`
222
+ - `.tc-token-string`
223
+ - `.tc-token-tag`
224
+ - `.tc-token-template`
225
+ - `.tc-token-type`
226
+ - `.tc-token-variable`
227
+
228
+ The initial no-dependency highlighters cover these fence labels:
229
+
230
+ - ECMAScript and TypeScript: `js`, `javascript`, `mjs`, `cjs`, `es6`, `jsx`, `ts`, `typescript`, `mts`, `cts`, `tsx`
231
+ - Data: `json`, `jsonc`, `jsonl`, `yaml`, `yml`
232
+ - CSS: `css`
233
+
234
+ These language labels are recognized but intentionally render as plain escaped code until a tokenizer exists:
235
+
236
+ - Styles and markup: `scss`, `sass`, `less`, `postcss`, `html`, `xml`, `svg`, `md`, `markdown`
237
+ - Shell, Python, SQL, and line-oriented formats: `sh`, `bash`, `shell`, `shellscript`, `zsh`, `fish`, `py`, `python`, `sql`, `ddl`, `dml`, `diff`, `patch`, `dockerfile`, `docker`, `ini`, `properties`, `toml`
238
+ - Explicit plain text: `text`, `txt`, `plain`, `plaintext`
239
+ - Other known languages: `rb`, `ruby`, `go`, `golang`, `java`, `c`, `cpp`, `c++`, `cc`, `cxx`, `cs`, `csharp`, `c#`, `rs`, `rust`, `php`
240
+
241
+ Unknown fence labels also render as plain escaped code. Code text is always escaped in HTML output, even when `allowRawHtml: true` is enabled.
242
+
117
243
  ### Static Rendering
118
244
 
119
245
  - `staticRender`: namespace containing the static rendering exports.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
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.79",
54
+ "toolcraft-schema": "0.0.80",
55
55
  "commander": "^13.1.0",
56
56
  "fast-string-width": "^3.0.2",
57
57
  "fast-wrap-ansi": "^0.2.0",