@offorte/show-doc 0.0.2 → 0.0.4

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 CHANGED
@@ -2,24 +2,29 @@
2
2
 
3
3
  **Write for agents. Render for people.**
4
4
 
5
- ShowDoc is an agent skill for Codex, Claude Code, and other compatible coding agents. It turns
6
- reports, plans, reviews, and explanations into polished HTML documents. You describe the document.
7
- The skill handles the structure, components, Markdown, and browser setup.
5
+ ShowDoc is an agent skill for Codex, Claude Code, and other compatible coding agents. It replaces
6
+ separate Markdown and HTML versions with one shared HTML artifact for agents and people.
8
7
 
9
- Agents work well with Markdown. It is compact, easy to scan, and cheap to change. People often need
10
- more visual structure. Clear type, spacing, status, columns, code, and optional detail make complex
11
- documents easier to read.
8
+ An agent writes compact Markdown and semantic `shw-*` elements. One JavaScript include
9
+ provides the components, Markdown rendering, presentation DOM, and CSS.
12
10
 
13
- Normal HTML artifacts solve the visual problem. They often repeat hundreds of lines of HTML, CSS,
14
- and JavaScript. That source is expensive for an agent to inspect whenever one sentence changes.
15
-
16
- The ShowDoc skill keeps the source small. It guides an agent to write Markdown and semantic `shw-*`
17
- elements. ShowDoc turns that source into a polished document.
11
+ The source DOM stays small and focused on content. Agents can read and update it without sorting
12
+ through repeated presentation code. People get clear type, spacing, status, columns, code, and
13
+ optional detail. There is no second version to keep in sync.
18
14
 
19
15
  In one practical review, a normal artifact was estimated at **300 to 800 lines**. The same document
20
16
  was estimated at **40 to 80 lines of ShowDoc source**. This is an illustrative comparison, not a
21
17
  fixed benchmark. The exact reduction depends on the document.
22
18
 
19
+ ## Example
20
+
21
+ Open [How Offorte ShowDoc works](https://offorte.github.io/show-doc/) to see a complete ShowDoc
22
+ document. It explains the authoring model and shows the components in a real page.
23
+
24
+ Then use **View Page Source** in your browser. The source contains compact `shw-*` elements,
25
+ Markdown, and one versioned CDN script. It does not contain copied component markup or presentation
26
+ CSS that an agent must maintain.
27
+
23
28
  ## What the skill creates
24
29
 
25
30
  The skill creates compact source that contains the meaning and layout decision:
@@ -45,9 +50,55 @@ Use ShowDoc for:
45
50
  ShowDoc is not intended for dashboards, forms, modals, or large interactive tools. Those need their
46
51
  own application code.
47
52
 
48
- See the complete [codebase overview artifact](./examples/codebase-overview.html). It uses ShowDoc to
49
- explain ShowDoc. Each release also publishes this artifact as the
50
- [live ShowDoc showcase](https://offorte.github.io/show-doc/).
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.
51
102
 
52
103
  ## Install the skill
53
104
 
@@ -76,10 +127,14 @@ Ask your agent for the document you need:
76
127
 
77
128
  > Use the ShowDoc skill to create a visual project update.
78
129
 
79
- The [`show-doc` skill](./skills/show-doc/SKILL.md) contains the full versioned runtime contract,
130
+ The [`show-doc` skill](./skills/show-doc/SKILL.md) contains the runtime setup,
80
131
  component reference, and authoring rules. It creates the complete HTML file for you. You do not need
81
132
  to choose a CDN script or write setup code.
82
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
+
83
138
  ## Safety
84
139
 
85
140
  ShowDoc uses Micromark with safe defaults. Raw HTML and dangerous URL protocols are not enabled in
@@ -101,12 +156,23 @@ pnpm build
101
156
  pnpm agent:verify
102
157
  ```
103
158
 
104
- `pnpm serve` rebuilds the production bundle and serves the isolated showcase at
159
+ `pnpm serve` rebuilds the package and serves the CDN-backed showcase at
105
160
  `http://127.0.0.1:4173`.
106
161
 
107
162
  `pnpm agent:verify` checks formatting, lint, TypeScript, browser behavior, the Custom Elements
108
163
  Manifest, bundle limits, package contents, and unused code.
109
164
 
165
+ ## Releases
166
+
167
+ Release Please reads Conventional Commit types on `main`. `fix:` and `opt:` prepare a patch release.
168
+ `feat:` prepares a minor release. A type with `!`, or a `BREAKING CHANGE` footer, prepares a major
169
+ release.
170
+
171
+ Merging the Release Please pull request creates the GitHub release. The `Release package` workflow
172
+ then verifies and publishes the npm package. After publication succeeds, it calls the separate
173
+ `Deploy Pages` workflow with the release tag. `Deploy Pages` only deploys the example site. It can
174
+ also run manually.
175
+
110
176
  ## About Offorte
111
177
 
112
178
  Offorte is automated proposal software that helps businesses create, send, and track beautiful,
@@ -182,7 +182,7 @@
182
182
  },
183
183
  {
184
184
  "kind": "class",
185
- "description": "Shows a syntax-highlighted code block with an optional filename.",
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. Supported values are html, js, ts, and json.",
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. Supported values are html, js, ts, and json.",
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 details behind a native disclosure control.",
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": {