@offorte/show-doc 0.0.3 → 0.0.5
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 +77 -4
- package/custom-elements.json +111 -4
- package/dist/THIRD_PARTY_LICENSES.md +444 -0
- package/dist/showdoc-mermaid.js +90393 -26287
- package/dist/showdoc.js +263 -578
- package/dist/types/components/shw-code.d.ts +19 -2
- package/dist/types/components/shw-collapsible.d.ts +7 -1
- package/dist/types/components/shw-mermaid.d.ts +6 -0
- package/package.json +8 -2
- package/skills/show-doc/SKILL.md +177 -37
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
ShowDoc is an agent skill for Codex, Claude Code, and other compatible coding agents. It replaces
|
|
6
6
|
separate Markdown and HTML versions with one shared HTML artifact for agents and people.
|
|
7
7
|
|
|
8
|
-
An agent writes compact Markdown and semantic `shw-*` elements. One
|
|
8
|
+
An agent writes compact Markdown and semantic `shw-*` elements. One JavaScript include
|
|
9
9
|
provides the components, Markdown rendering, presentation DOM, and CSS.
|
|
10
10
|
|
|
11
11
|
The source DOM stays small and focused on content. Agents can read and update it without sorting
|
|
@@ -50,6 +50,56 @@ Use ShowDoc for:
|
|
|
50
50
|
ShowDoc is not intended for dashboards, forms, modals, or large interactive tools. Those need their
|
|
51
51
|
own application code.
|
|
52
52
|
|
|
53
|
+
## Plans and change recaps
|
|
54
|
+
|
|
55
|
+
Build a plan from an outcome, a focused comparison or diagram, and steps with clear checks. Build
|
|
56
|
+
a recap from the resulting behavior, a real change excerpt, and the checks that actually ran.
|
|
57
|
+
Existing grids, sections, cards, figures, and tables supply the structure.
|
|
58
|
+
|
|
59
|
+
For code, `shw-code` supports `language="diff"` for supplied unified patches, `line-numbers`,
|
|
60
|
+
`highlight="2,4-6"`, and notes tied to lines:
|
|
61
|
+
|
|
62
|
+
<!-- prettier-ignore -->
|
|
63
|
+
```html
|
|
64
|
+
<shw-code
|
|
65
|
+
filename="save.ts"
|
|
66
|
+
language="ts"
|
|
67
|
+
line-numbers
|
|
68
|
+
highlight="2"
|
|
69
|
+
annotations='[{"start":2,"text":"Clear the draft only after the save succeeds."}]'
|
|
70
|
+
>
|
|
71
|
+
await save(draft);
|
|
72
|
+
clearDraft();
|
|
73
|
+
</shw-code>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Annotations are a JSON array of `start`, optional `end`, and Markdown `text`. Line references are
|
|
77
|
+
1-based positions in the displayed excerpt, including any diff headers. They are not file line
|
|
78
|
+
numbers. Invalid JSON or ranges show an authoring message without hiding the source. Notes remain
|
|
79
|
+
visible below the code. ShowDoc does not fetch source, compute changes, or verify claims.
|
|
80
|
+
|
|
81
|
+
Use `shw-collapsible content="blocks"` for expandable evidence that contains other components:
|
|
82
|
+
|
|
83
|
+
<!-- prettier-ignore -->
|
|
84
|
+
```html
|
|
85
|
+
<shw-collapsible summary="Supporting evidence" content="blocks">
|
|
86
|
+
<shw-code filename="save.ts" language="ts">await save(draft);</shw-code>
|
|
87
|
+
<shw-table caption="Checks">
|
|
88
|
+
Check | Result
|
|
89
|
+
Save retry | Not run
|
|
90
|
+
</shw-table>
|
|
91
|
+
</shw-collapsible>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The default disclosure body remains Markdown. In blocks mode, wrap prose in `shw-markdown`.
|
|
95
|
+
The [authoring skill](./skills/show-doc/SKILL.md) includes plan and recap recipes, comparison
|
|
96
|
+
guidance, source escaping rules, and the full compact API.
|
|
97
|
+
|
|
98
|
+
Documents default to light mode, regardless of the system theme. The theme uses a clear title,
|
|
99
|
+
restrained accents, distinct metrics, and subtle surface contrast.
|
|
100
|
+
Use visual variety to explain the content: short comparisons in a grid, wide evidence in a full
|
|
101
|
+
section, and secondary detail in a disclosure. Keep uncertain results and open decisions explicit.
|
|
102
|
+
|
|
53
103
|
## Install the skill
|
|
54
104
|
|
|
55
105
|
After you download or clone this repository, copy the complete [`skills/show-doc`](./skills/show-doc/)
|
|
@@ -77,10 +127,33 @@ Ask your agent for the document you need:
|
|
|
77
127
|
|
|
78
128
|
> Use the ShowDoc skill to create a visual project update.
|
|
79
129
|
|
|
80
|
-
The [`show-doc` skill](./skills/show-doc/SKILL.md) contains the
|
|
130
|
+
The [`show-doc` skill](./skills/show-doc/SKILL.md) contains the runtime setup,
|
|
81
131
|
component reference, and authoring rules. It creates the complete HTML file for you. You do not need
|
|
82
132
|
to choose a CDN script or write setup code.
|
|
83
133
|
|
|
134
|
+
The skill uses `@latest` CDN URLs by default, so generated documents can receive future published
|
|
135
|
+
updates. Ask for an exact version when a document needs to keep the same runtime. The released
|
|
136
|
+
showcase stays pinned to its matching package version.
|
|
137
|
+
|
|
138
|
+
## Diagrams
|
|
139
|
+
|
|
140
|
+
`shw-mermaid` draws flowcharts, state diagrams, and sequence diagrams with cards, routed lines, and
|
|
141
|
+
a dotted canvas that the reader can drag and zoom. An expand button shows any diagram over the full
|
|
142
|
+
window, with a button for light and dark. Subgraphs become lanes. The classes `new`,
|
|
143
|
+
`changed`, and `removed` add a status pill. A frontmatter title appears in a chip, and text after
|
|
144
|
+
`|` appears as grey code. Mermaid draws all other diagram types. These diagrams use React Flow, so
|
|
145
|
+
the Mermaid bundle includes React and shows a small React Flow link in the corner.
|
|
146
|
+
|
|
147
|
+
Add the `page` attribute and leave out `shw-doc` to show one diagram in the full browser window:
|
|
148
|
+
|
|
149
|
+
<!-- prettier-ignore -->
|
|
150
|
+
```html
|
|
151
|
+
<shw-mermaid page label="Saving a draft">
|
|
152
|
+
flowchart LR
|
|
153
|
+
A[Save draft] --> B{Save succeeds?}
|
|
154
|
+
</shw-mermaid>
|
|
155
|
+
```
|
|
156
|
+
|
|
84
157
|
## Safety
|
|
85
158
|
|
|
86
159
|
ShowDoc uses Micromark with safe defaults. Raw HTML and dangerous URL protocols are not enabled in
|
|
@@ -99,13 +172,13 @@ pnpm install --frozen-lockfile
|
|
|
99
172
|
pnpm dev
|
|
100
173
|
pnpm serve
|
|
101
174
|
pnpm build
|
|
102
|
-
pnpm agent:
|
|
175
|
+
pnpm agent:check
|
|
103
176
|
```
|
|
104
177
|
|
|
105
178
|
`pnpm serve` rebuilds the package and serves the CDN-backed showcase at
|
|
106
179
|
`http://127.0.0.1:4173`.
|
|
107
180
|
|
|
108
|
-
`pnpm agent:
|
|
181
|
+
`pnpm agent:check` checks formatting, lint, TypeScript, browser behavior, the Custom Elements
|
|
109
182
|
Manifest, bundle limits, package contents, and unused code.
|
|
110
183
|
|
|
111
184
|
## Releases
|
package/custom-elements.json
CHANGED
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
"kind": "class",
|
|
185
|
-
"description": "Shows a
|
|
185
|
+
"description": "Shows code or a supplied unified diff, with optional source line numbers and notes.",
|
|
186
186
|
"name": "ShwCode",
|
|
187
187
|
"members": [
|
|
188
188
|
{
|
|
@@ -204,8 +204,41 @@
|
|
|
204
204
|
"text": "string"
|
|
205
205
|
},
|
|
206
206
|
"default": "\"text\"",
|
|
207
|
-
"description": "Syntax language
|
|
207
|
+
"description": "Syntax language: html, js, ts, json, or diff for a supplied unified diff.",
|
|
208
208
|
"attribute": "language"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"kind": "field",
|
|
212
|
+
"name": "lineNumbers",
|
|
213
|
+
"privacy": "public",
|
|
214
|
+
"type": {
|
|
215
|
+
"text": "boolean"
|
|
216
|
+
},
|
|
217
|
+
"default": "false",
|
|
218
|
+
"description": "Show 1-based positions in the displayed source, including diff headers.",
|
|
219
|
+
"attribute": "line-numbers"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "field",
|
|
223
|
+
"name": "highlight",
|
|
224
|
+
"privacy": "public",
|
|
225
|
+
"type": {
|
|
226
|
+
"text": "string"
|
|
227
|
+
},
|
|
228
|
+
"default": "\"\"",
|
|
229
|
+
"description": "Source lines to emphasize, for example 2,4-6.",
|
|
230
|
+
"attribute": "highlight"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"kind": "field",
|
|
234
|
+
"name": "annotations",
|
|
235
|
+
"privacy": "public",
|
|
236
|
+
"type": {
|
|
237
|
+
"text": "string"
|
|
238
|
+
},
|
|
239
|
+
"default": "\"\"",
|
|
240
|
+
"description": "JSON array of { start, end?, text } notes. Text is safe Markdown; lines are 1-based.",
|
|
241
|
+
"attribute": "annotations"
|
|
209
242
|
}
|
|
210
243
|
],
|
|
211
244
|
"attributes": [
|
|
@@ -224,8 +257,35 @@
|
|
|
224
257
|
"text": "string"
|
|
225
258
|
},
|
|
226
259
|
"default": "\"text\"",
|
|
227
|
-
"description": "Syntax language
|
|
260
|
+
"description": "Syntax language: html, js, ts, json, or diff for a supplied unified diff.",
|
|
228
261
|
"fieldName": "language"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "line-numbers",
|
|
265
|
+
"type": {
|
|
266
|
+
"text": "boolean"
|
|
267
|
+
},
|
|
268
|
+
"default": "false",
|
|
269
|
+
"description": "Show 1-based positions in the displayed source, including diff headers.",
|
|
270
|
+
"fieldName": "lineNumbers"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "highlight",
|
|
274
|
+
"type": {
|
|
275
|
+
"text": "string"
|
|
276
|
+
},
|
|
277
|
+
"default": "\"\"",
|
|
278
|
+
"description": "Source lines to emphasize, for example 2,4-6.",
|
|
279
|
+
"fieldName": "highlight"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"name": "annotations",
|
|
283
|
+
"type": {
|
|
284
|
+
"text": "string"
|
|
285
|
+
},
|
|
286
|
+
"default": "\"\"",
|
|
287
|
+
"description": "JSON array of { start, end?, text } notes. Text is safe Markdown; lines are 1-based.",
|
|
288
|
+
"fieldName": "annotations"
|
|
229
289
|
}
|
|
230
290
|
],
|
|
231
291
|
"superclass": {
|
|
@@ -237,8 +297,14 @@
|
|
|
237
297
|
},
|
|
238
298
|
{
|
|
239
299
|
"kind": "class",
|
|
240
|
-
"description": "Hides optional Markdown
|
|
300
|
+
"description": "Hides optional Markdown or child document blocks behind a native disclosure control.",
|
|
241
301
|
"name": "ShwCollapsible",
|
|
302
|
+
"slots": [
|
|
303
|
+
{
|
|
304
|
+
"description": "Document blocks when content=\"blocks\".",
|
|
305
|
+
"name": ""
|
|
306
|
+
}
|
|
307
|
+
],
|
|
242
308
|
"members": [
|
|
243
309
|
{
|
|
244
310
|
"kind": "field",
|
|
@@ -262,9 +328,29 @@
|
|
|
262
328
|
"default": "\"Details\"",
|
|
263
329
|
"description": "Label for the disclosure control.",
|
|
264
330
|
"attribute": "summary"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"kind": "field",
|
|
334
|
+
"name": "content",
|
|
335
|
+
"privacy": "public",
|
|
336
|
+
"type": {
|
|
337
|
+
"text": "\"markdown\" | \"blocks\""
|
|
338
|
+
},
|
|
339
|
+
"default": "\"markdown\"",
|
|
340
|
+
"description": "Body input: Markdown text by default, or slotted document blocks.",
|
|
341
|
+
"attribute": "content"
|
|
265
342
|
}
|
|
266
343
|
],
|
|
267
344
|
"attributes": [
|
|
345
|
+
{
|
|
346
|
+
"name": "content",
|
|
347
|
+
"type": {
|
|
348
|
+
"text": "\"markdown\" | \"blocks\""
|
|
349
|
+
},
|
|
350
|
+
"default": "\"markdown\"",
|
|
351
|
+
"description": "Body input: Markdown text by default, or slotted document blocks.",
|
|
352
|
+
"fieldName": "content"
|
|
353
|
+
},
|
|
268
354
|
{
|
|
269
355
|
"name": "open",
|
|
270
356
|
"type": {
|
|
@@ -981,6 +1067,18 @@
|
|
|
981
1067
|
"default": "\"Diagram\"",
|
|
982
1068
|
"description": "Accessible name for the rendered diagram.",
|
|
983
1069
|
"attribute": "label"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
"kind": "field",
|
|
1073
|
+
"name": "page",
|
|
1074
|
+
"privacy": "public",
|
|
1075
|
+
"type": {
|
|
1076
|
+
"text": "boolean"
|
|
1077
|
+
},
|
|
1078
|
+
"default": "false",
|
|
1079
|
+
"description": "Fills the browser window with this one diagram. Use it without `shw-doc`.",
|
|
1080
|
+
"attribute": "page",
|
|
1081
|
+
"reflects": true
|
|
984
1082
|
}
|
|
985
1083
|
],
|
|
986
1084
|
"attributes": [
|
|
@@ -992,6 +1090,15 @@
|
|
|
992
1090
|
"default": "\"Diagram\"",
|
|
993
1091
|
"description": "Accessible name for the rendered diagram.",
|
|
994
1092
|
"fieldName": "label"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"name": "page",
|
|
1096
|
+
"type": {
|
|
1097
|
+
"text": "boolean"
|
|
1098
|
+
},
|
|
1099
|
+
"default": "false",
|
|
1100
|
+
"description": "Fills the browser window with this one diagram. Use it without `shw-doc`.",
|
|
1101
|
+
"fieldName": "page"
|
|
995
1102
|
}
|
|
996
1103
|
],
|
|
997
1104
|
"superclass": {
|