sdocs-dev 1.14.1 → 1.18.0

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/lib/help-text.js CHANGED
@@ -12,6 +12,8 @@ USAGE
12
12
  sdoc <file> --style Open with style panel
13
13
  sdoc <file> --raw Open raw markdown source
14
14
  sdoc <file> --comment Open in comment mode (review/annotate)
15
+ sdoc <file> 12:"note" 24-28:"note"
16
+ Open a guided document walkthrough
15
17
  sdoc bridge <file> Live editing session: edits autosave to disk,
16
18
  external changes push to the page (see LIVE BRIDGE)
17
19
  sdoc new New blank document (write mode)
@@ -22,6 +24,7 @@ USAGE
22
24
  sdoc charts Chart types, options, and styling guide
23
25
  sdoc diagrams Mermaid diagrams reference (\`\`\`mermaid blocks)
24
26
  sdoc videos YouTube embed reference (\`\`\`video blocks)
27
+ sdoc apps Runnable HTML reference (\`\`\`sdoc-app blocks)
25
28
  sdoc cells Inline spreadsheet reference (\`\`\`cells blocks)
26
29
  sdoc code Syntax highlighting + code-viewer reference
27
30
  sdoc app.rb / server.js / ... Open a source file as a highlighted listing
@@ -35,16 +38,24 @@ USAGE
35
38
  sdoc slides list Built-in slide template registry + slot names
36
39
  sdoc slides icons [query] Lucide icon names available to the \`icon\` shape kind
37
40
  sdoc slides custom-shapes Raw-shape primitives + design principles reference
41
+ sdoc slides verify <file> Validate slide syntax and geometry without a browser
42
+ sdoc slides verify <file> --json Machine-readable validation output for agents
38
43
  sdoc present <file> Open <file> and jump straight into fullscreen slides
39
44
  sdoc library Open the personal markdown library at smalldocs.org/library
40
45
  sdoc library ls List markdown indexed in this project (walks up to .git)
41
46
  sdoc library ls --tags Tag bag (tag - count) for this project
42
47
  sdoc library --help Full library reference - commands, tagging, rescue, autostart
48
+ sdoc cloud login Sign this CLI into SmallDocs Cloud once
49
+ sdoc cloud status --json Check the connected Cloud account
50
+ sdoc cloud ls List Cloud documents
51
+ sdoc cloud search "query" Search Cloud documents
52
+ sdoc cloud create file.md Add a document to Cloud
53
+ sdoc cloud --help Full Cloud command reference
43
54
  sdoc <file> +tag1 +tag2 Inject tags into the file's front matter at open time
44
55
  sdoc defaults Show ~/.sdocs/styles.yaml
45
56
  sdoc defaults --reset Remove default styles
46
- sdoc setup Wire SmallDocs into your coding agents
47
- sdoc refresh Update the SmallDocs section in agent files to the current version
57
+ sdoc setup Install the SmallDocs skill for your coding agents
58
+ sdoc refresh Refresh the SmallDocs skill to the current version
48
59
  sdoc auto-update [on|off] Toggle auto-install of sdoc updates
49
60
  sdoc upgrade Upgrade sdoc to the latest version now
50
61
  sdoc safe Verify the SmallDocs server is running the published code
@@ -72,7 +83,7 @@ OPTIONS
72
83
  --mode <m> Alias for --read / --write / --style / --raw / --comment
73
84
  --short Use the encrypted /s/<id> short-URL form (share
74
85
  subcommand only). See SHORT LINKS below.
75
- --json Machine-readable output (safe subcommand only).
86
+ --json Machine-readable output for safe and Cloud commands.
76
87
  --audit Also print GitHub links to server-side source
77
88
  files (safe subcommand only).
78
89
  --keep-open feedback subcommand: keep the bridge alive across
@@ -86,6 +97,22 @@ OPTIONS
86
97
  ENVIRONMENT
87
98
  SDOCS_URL Fallback base URL if --url is not passed.
88
99
 
100
+ DOCUMENT WALKTHROUGHS
101
+ Add notes after a Markdown filename to guide a reader through the
102
+ rendered document:
103
+
104
+ sdoc report.md 12:"Start with the result" 24-28:"Compare these figures"
105
+
106
+ Each source line or range becomes a highlighted target followed by a
107
+ markdown note with Prev / Next controls. Steps follow command argument
108
+ order, not source order. A prose line highlights its matching rendered
109
+ text. A line inside an ordinary code fence highlights that code line
110
+ and places the note beneath it. A chart, diagram, sheet, slide, form,
111
+ math block, or video is highlighted as one complete rendered element.
112
+
113
+ The annotations ride in the URL and through sdoc share. The source file
114
+ is unchanged.
115
+
89
116
  INTERACTIVE FEEDBACK (sdoc feedback)
90
117
  An agent writes a fenced \`\`\`form block into a markdown file and runs
91
118
  \`sdoc feedback file.md\`. The browser renders real form controls
@@ -146,7 +173,6 @@ LIBRARY (personal, on-machine index)
146
173
  sdoc library Open the search UI.
147
174
  sdoc library ls List indexed files in this project.
148
175
  sdoc library ls --tags Tag bag (tag - count) for this project.
149
- sdoc library rebuild Walk \$HOME and refresh every entry.
150
176
  sdoc library status Show enabled/disabled + entry count.
151
177
  sdoc library autostart Manage the macOS LaunchAgent.
152
178
 
@@ -978,6 +1004,141 @@ SECURITY
978
1004
  `;
979
1005
 
980
1006
 
1007
+ const APPS_HELP = `
1008
+ SmallDocs - Runnable HTML
1009
+ ========================
1010
+ Run a self-contained HTML document inside Markdown using a \`\`\`sdoc-app
1011
+ fenced code block. The component appears inline and can expand to fill the
1012
+ browser window. Use this for interactive models, calculators, simulations,
1013
+ and other agent-authored browser tools.
1014
+
1015
+ BASIC SYNTAX
1016
+ \`\`\`sdoc-app
1017
+ <!doctype html>
1018
+ <html>
1019
+ <head>
1020
+ <meta name="viewport" content="width=device-width, initial-scale=1">
1021
+ <title>Counter</title>
1022
+ </head>
1023
+ <body>
1024
+ <button id="count">Count: 0</button>
1025
+ <script>
1026
+ let value = 0;
1027
+ const button = document.getElementById('count');
1028
+ button.onclick = () => button.textContent = 'Count: ' + (++value);
1029
+ </script>
1030
+ </body>
1031
+ </html>
1032
+ \`\`\`
1033
+
1034
+ AUTHORING
1035
+ - Put one complete HTML document in each block.
1036
+ - Use <title> to name the component in its toolbar and fullscreen view.
1037
+ - CSS, inline JavaScript, canvas, SVG, forms, and browser-native controls work.
1038
+ - Package required data and code in the document when the component should
1039
+ keep working without an external service.
1040
+ - An ordinary \`\`\`html fence remains a highlighted source listing.
1041
+
1042
+ INHERITED DESIGN
1043
+ Bare semantic HTML starts with the SmallDocs document's current typography,
1044
+ text and heading colours, background, accent, border, surface, spacing, and
1045
+ corner radius. Native controls receive the same font and a restrained base
1046
+ treatment. These values update when the document theme or styles change.
1047
+
1048
+ The defaults live in a low-priority CSS layer. Ordinary component CSS wins.
1049
+ Override individual values through these custom properties:
1050
+
1051
+ --sdoc-app-background --sdoc-app-surface
1052
+ --sdoc-app-color --sdoc-app-heading-color
1053
+ --sdoc-app-muted-color --sdoc-app-accent-color
1054
+ --sdoc-app-border-color --sdoc-app-font-family
1055
+ --sdoc-app-heading-font-family --sdoc-app-code-font-family
1056
+ --sdoc-app-font-size --sdoc-app-line-height
1057
+ --sdoc-app-heading-scale
1058
+ --sdoc-app-h1-size --sdoc-app-h2-size
1059
+ --sdoc-app-h3-size --sdoc-app-h1-weight
1060
+ --sdoc-app-h2-weight --sdoc-app-h3-weight
1061
+ --sdoc-app-radius --sdoc-app-block-spacing
1062
+ --sdoc-app-padding --sdoc-app-color-scheme
1063
+
1064
+ Example override:
1065
+
1066
+ :root { --sdoc-app-background: #101827; --sdoc-app-color: #f8fafc; }
1067
+ body { padding: 12px; }
1068
+
1069
+ Do not repeat a body reset, font stack, or page background when the inherited
1070
+ design is appropriate. Add CSS for the component's layout and intentional
1071
+ visual differences. The bundled Inter faces load inside the component.
1072
+ Load other webfonts inside the component when their exact face is required.
1073
+
1074
+ VISUAL DIRECTION
1075
+ Let the tool's purpose determine its layout. Start with semantic HTML and the
1076
+ inherited design, then add treatment where it clarifies hierarchy, grouping,
1077
+ state, or interaction.
1078
+
1079
+ - Try a clear page, list, table, or form before turning every region into a
1080
+ dashboard card. Use a canvas or stage when the interaction is spatial.
1081
+ Whitespace and dividers are often enough to structure repeated rows.
1082
+ For repeated records, try one list with border-bottom separators before
1083
+ wrapping every record in its own card.
1084
+ - Reserve a bordered or raised surface for content that needs to read as a
1085
+ separate group, selection, or interaction. Avoid stacking several levels
1086
+ of rounded containers only to create hierarchy.
1087
+ - Keep a consistent shape language and begin with the inherited radius.
1088
+ Pills suit compact statuses and category choices; ordinary actions and
1089
+ metrics do not need to become pills.
1090
+ - For an ordinary document tool, leave the inherited design tokens unchanged
1091
+ unless the brief calls for a distinct visual direction. Add semantic colour
1092
+ when it carries meaning. Gradients, glows, and shadows should support the
1093
+ subject or interaction rather than decorate empty space.
1094
+ - Accent rails, badges, uppercase eyebrows, and wide letter spacing are
1095
+ conspicuous patterns. Use them when they communicate something specific,
1096
+ not as automatic decoration. A title does not also need an eyebrow unless
1097
+ that label adds context the title does not contain.
1098
+ - Match density to the task. Repeated controls should read as efficient rows;
1099
+ the primary result or working area should receive the strongest emphasis.
1100
+ A few totals can often share one summary line or bar instead of separate
1101
+ metric cards.
1102
+
1103
+ SIZING AND RESPONSIVE LAYOUT
1104
+ The component owns its inline height. SmallDocs measures the complete
1105
+ document and follows that height without imposing a minimum or maximum. The
1106
+ frame width follows the SmallDocs reading column. Fullscreen uses the
1107
+ available browser viewport.
1108
+
1109
+ - Include a viewport meta tag in every component.
1110
+ - Let normal document flow determine height when content can grow.
1111
+ - Use the component's own CSS min-height, height, or aspect-ratio when an
1112
+ interactive canvas or stage needs a deliberate working area.
1113
+ - Avoid fixed page widths. Use fluid widths, grid or flex wrapping, media or
1114
+ container queries, and controls that remain usable at narrow widths.
1115
+ - Resize canvas and other measured graphics from their rendered container.
1116
+ ResizeObserver and the normal window resize event are available.
1117
+ - Check the component inline and fullscreen at both narrow and wide widths.
1118
+
1119
+ A concise inline height keeps the surrounding document easy to navigate.
1120
+ Dense tools can use more space or rely on the expand control. These are
1121
+ authoring choices rather than renderer limits.
1122
+
1123
+ VIEWING
1124
+ Expand opens the same running frame fullscreen, so its current inputs and
1125
+ JavaScript state remain in place. When a document has several components,
1126
+ Previous and Next move between them.
1127
+
1128
+ BROWSER BOUNDARY
1129
+ Component code runs in a sandboxed frame. It cannot read the SmallDocs page,
1130
+ browser storage for smalldocs.org, or account controls. Scripts can use forms,
1131
+ modals, downloads, and popups. Network requests still leave the browser and
1132
+ are subject to the destination's CORS rules, so a document can communicate
1133
+ with services that allow it.
1134
+
1135
+ FAILURE BEHAVIOUR
1136
+ If the runner cannot start or does not respond within 15 seconds, SmallDocs
1137
+ leaves the component source readable in an error panel. Re-rendering or
1138
+ destroying an SDK instance removes its frames and event listeners.
1139
+ `;
1140
+
1141
+
981
1142
  const CELLS_HELP = `
982
1143
  SmallDocs - Cells (sheets)
983
1144
  ======================
@@ -1018,27 +1179,40 @@ WRAPPING
1018
1179
  text - markup never renders.
1019
1180
 
1020
1181
  FORMATTING
1021
- Numbers display with thousands separators and negatives in red by default.
1022
- An optional first line sets per-column formats by column letter:
1182
+ Numbers display with thousands separators and up to two decimal places by
1183
+ default. Negatives are red. One or more leading format: lines can control a
1184
+ sheet, column, row, or individual cell:
1023
1185
 
1024
1186
  \`\`\`cells
1025
- format: A=plain B=$ C=%
1187
+ format: A=plain B=$ C=% C4=%.1
1026
1188
  Year,Revenue,Margin
1027
1189
  2024,12000,0.23
1028
1190
  \`\`\`
1029
1191
 
1030
1192
  Renders 2024 (plain - no comma), $12,000.00, 23%.
1031
1193
 
1032
- Format tokens (keyed by column letter):
1194
+ Targets use familiar sheet addresses:
1195
+ * whole sheet
1196
+ A column A
1197
+ 4 row 4
1198
+ C4 cell C4
1199
+
1200
+ A cell overrides its row, a row overrides its column, and a column overrides
1201
+ the whole sheet. This makes \`format: B=$ B4=%\` a currency column with one
1202
+ percentage cell.
1203
+
1204
+ Format tokens:
1033
1205
  $ / usd currency, e.g. $12,000.00 (also £ / gbp, € / eur)
1034
1206
  % percent - multiplies by 100, e.g. 0.23 -> 23%
1035
- , / number thousands separators (the default)
1207
+ , / number thousands separators
1036
1208
  plain / text no number formatting (good for years, ids, codes)
1037
- .N suffix fixed decimals, e.g. $.0 (no cents), %.1, .2
1209
+ .N suffix fixed decimals, attached directly: $.0, %.1, .2
1038
1210
 
1039
- Formatting is display only - copy and export always emit the original
1040
- values. This is what makes a cells block more than a CSV: the author
1041
- chooses how each column reads.
1211
+ Each target accepts one format token. Use C=%.2, not C=%,.2. Unknown or
1212
+ malformed rules are ignored without changing the sheet's data.
1213
+
1214
+ Formatting changes appearance, not the underlying values. Copy preserves
1215
+ the source values; Excel export preserves both the values and number formats.
1042
1216
 
1043
1217
  FORMULAS
1044
1218
  A cell whose value starts with = is a formula, evaluated in the browser.
@@ -1287,7 +1461,8 @@ EXPORT
1287
1461
  formulas and recalculate when the file opens; the format: directive's
1288
1462
  currency / percent / comma columns carry over as Excel number formats.
1289
1463
  The export uses the document's row order (plus any fullscreen edits),
1290
- never the sorted view, so formula references stay correct.
1464
+ never the sorted view, so formula references stay correct. Sheet, column,
1465
+ row, and cell number formats carry over to Excel.
1291
1466
  `;
1292
1467
 
1293
1468
  const SLIDES_HELP = `
@@ -1299,6 +1474,31 @@ present-mode icon in the slide's top-right corner to enter fullscreen.
1299
1474
  Text inside a slide thumbnail is selectable. Esc to exit, arrows to
1300
1475
  navigate.
1301
1476
 
1477
+ \u2500\u2500 START HERE \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1478
+ Use \`@extends\` for covers, section breaks, quotations, simple
1479
+ text, and layouts that repeat. Fill named slots and the template
1480
+ handles layout, spacing, and alignment for you:
1481
+
1482
+ ~~~slide
1483
+ @extends title-body
1484
+ #title: What is SmallDocs?
1485
+ #body:
1486
+ - Markdown in, styled docs out
1487
+ - No server, hash-only state
1488
+ ~~~
1489
+
1490
+ Run \`sdoc slides list\` for the template + slot names (cover,
1491
+ title-body, two-column, three-column, exhibit, quote, metric,
1492
+ section, closing).
1493
+
1494
+ Use custom shapes when geometry explains the idea: a process,
1495
+ architecture, hierarchy, comparison, feedback loop, market
1496
+ structure, or causal model. This applies to internal presentations
1497
+ too. An internal audience should be able to see the model instead
1498
+ of reconstructing it from title-and-bullet slides. Mix templates
1499
+ and custom slides in the same deck. Read DESIGN GUIDELINES and
1500
+ \`sdoc slides custom-shapes\` before hand-placing shapes.
1501
+
1302
1502
  \u2500\u2500 COMMANDS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1303
1503
  sdoc present <file> Open file directly in fullscreen slide view
1304
1504
  sdoc <file> Open normally (click a slide's present icon)
@@ -1306,9 +1506,11 @@ navigate.
1306
1506
  sdoc slides list List built-in templates + slot names
1307
1507
  sdoc slides icons [query] List the Lucide icons available to the
1308
1508
  \`icon\` shape kind. Optional substring filter.
1309
- sdoc slides custom-shapes Long-tail notes for raw-shape custom slides
1310
- (polygon text, composite patterns, layering).
1311
- Most decks use \`@extends\` and never need this.
1509
+ sdoc slides custom-shapes Shape syntax and design guidance for visual
1510
+ explanations, diagrams, and custom layouts.
1511
+ sdoc slides verify <file> Validate every slide headlessly. Exit 0 when
1512
+ clean, 1 for diagnostics, or 2 for bad usage.
1513
+ sdoc slides verify <file> --json Return the same result as structured JSON.
1312
1514
 
1313
1515
  ── DESIGN GUIDELINES ────────────────────────────────────
1314
1516
  The built-in templates encode a few rules that separate professional
@@ -1316,6 +1518,14 @@ navigate.
1316
1518
  template), keep these in mind - they're the difference between a
1317
1519
  deck that lands and one that doesn't.
1318
1520
 
1521
+ Match the layout to the information. Templates are the fast path
1522
+ for covers, section breaks, simple text, and repeated structures.
1523
+ Raw shapes are the explanatory path when position, direction,
1524
+ grouping, size, or sequence carries meaning. Audience type does
1525
+ not decide this: internal architecture and process decks often
1526
+ benefit most from a visual model. See \`sdoc slides custom-shapes\`
1527
+ for the shape vocabulary and the design principles that go with it.
1528
+
1319
1529
  Margins. Keep all content inside a 1-unit safe area on every side
1320
1530
  of a 16x9 grid (so x ∈ [1, 15], y ∈ [0.5, 8.5]). Nothing touches
1321
1531
  the slide edge except a deliberate full-bleed background (\`section\`
@@ -1346,9 +1556,13 @@ navigate.
1346
1556
  Caption renders as ~3px in a 240px-wide thumbnail - never put
1347
1557
  load-bearing content in caption role.
1348
1558
 
1349
- Default \`valign=center\`. \`valign=top\` reads right only when the
1350
- body shape is sized to its content. On an oversized body shape
1351
- top-anchoring leaves dead space underneath; centering balances it.
1559
+ Use \`valign=top\` for body copy - bullets, paragraphs, columns.
1560
+ Text has a reading order and a top edge readers expect just under
1561
+ the title, so anchor it there and let it grow down. \`valign=center\`
1562
+ is for a single short block that balances its box or a neighbouring
1563
+ visual (a takeaway beside a chart, a caption, a lead line) - not for
1564
+ a list. If a top-anchored body leaves dead space below, shrink the
1565
+ shape rather than re-centering the text.
1352
1566
 
1353
1567
  Content fills 55-65% of the safe area, no more. Empty space is a
1354
1568
  feature: it's what makes a deck feel confident rather than crowded.
@@ -1366,9 +1580,56 @@ navigate.
1366
1580
  A bulleted paragraph is hiding the fact that you haven't decided
1367
1581
  what you're claiming.
1368
1582
 
1369
- When in doubt, \`@extends\` a built-in template instead of
1370
- composing from raw shapes. Run \`sdoc slides list\` to see the
1371
- registry.
1583
+ Do not default an internal deck to title-and-bullet templates.
1584
+ If the slide explains relationships, stages, or movement, compose
1585
+ those relationships with shapes. If a custom layout repeats across
1586
+ slides, define it once as your own \`@template\` and \`@extends\` it -
1587
+ the consistency of a template with a look you designed.
1588
+
1589
+ \u2500\u2500 VERIFYING A DECK (OPTIONAL, BUT IT IS WHAT SEPARATES CLEAN FROM BROKEN) \u2500\u2500
1590
+ Run \`sdoc slides verify <file> --json\` after authoring. It uses the
1591
+ same parser, template resolver, reference resolver, and bounds check
1592
+ as the browser. Fix every reported problem or acknowledge intentional
1593
+ off-canvas decoration on that shape with \`bleed=allow\`, then run it
1594
+ again. The command exits 0 only when the deck is clean.
1595
+
1596
+ You are authoring slides you cannot see. You place coordinates and
1597
+ trust them, and the renderer does not warn you when a shape covers
1598
+ text, when a label wraps to a line you did not intend, when text sits
1599
+ on a fill it cannot be read against, or when an arrow lands in empty
1600
+ space. Templates mostly avoid this; hand-placed raw shapes do not.
1601
+ The single most effective check is to look at the rendered result and
1602
+ fix what you see.
1603
+
1604
+ If you have a way to render a page to an image - a headless browser
1605
+ you can drive (Playwright or Puppeteer in headless mode, a headless
1606
+ system Chrome), or any screenshot tool in your environment - use it.
1607
+ Open the deck, capture the slides, look, fix the DSL, and render
1608
+ again. Two or three passes turns a deck with hidden text and clipped
1609
+ labels into one that reads cleanly. When you render, check each slide
1610
+ for:
1611
+ - text covered by a shape drawn after it (source order is paint order)
1612
+ - text with poor contrast against whatever is actually painted under it
1613
+ - labels that wrap or overflow their box
1614
+ - connectors (l / a) that float short of, or pierce, what they join
1615
+ - a composition that sits low, high, or lopsided in the frame
1616
+
1617
+ The CLI does not bundle a browser - it has no runtime dependencies on
1618
+ purpose - so this check is something you bring from your environment,
1619
+ not something sdoc installs. If you do not have a headless browser and
1620
+ you judge that rendering would catch real problems, you can ask your
1621
+ user to install one (for example \`npx playwright install chromium\`, or
1622
+ to point you at a browser already on the machine) and explain why: a
1623
+ render check catches the text-overlap, contrast, and wrapping faults
1624
+ that are invisible in the markdown source. Leave the decision to them;
1625
+ it is their machine, and the subtleties of what is available are yours
1626
+ to work out in context.
1627
+
1628
+ \`sdoc present <file>\` opens the deck fullscreen for a human to review,
1629
+ which is the right check when a person is in the loop. If you cannot
1630
+ render at all, keep each slide simple enough to verify by arithmetic -
1631
+ list every text shape's box and confirm no later shape's fill overlaps
1632
+ it - and prefer templates for anything you will not be able to see.
1372
1633
 
1373
1634
  \u2500\u2500 FENCE SYNTAX \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1374
1635
  Wrap shape DSL in a ~~~slide fenced block:
@@ -1586,7 +1847,8 @@ navigate.
1586
1847
  Everything after \`|\` is standard markdown. Multi-line uses
1587
1848
  indentation under the shape line - continuation lines MUST be
1588
1849
  indented at least 2 spaces, or the parser treats them as fresh
1589
- top-level shape lines (and fails).
1850
+ top-level shape lines (and fails). In short inline labels, \`\\n\`
1851
+ inserts a visible line break; \`\\\\n\` keeps the literal text \`\\n\`.
1590
1852
 
1591
1853
  r 5 20 90 60 align=left |
1592
1854
  ## Heading
@@ -1609,17 +1871,20 @@ navigate.
1609
1871
  - Title shapes (one heading or phrase)
1610
1872
  - Subheaders, section labels
1611
1873
  - Standalone caption text
1874
+ - A single short block balancing a box or a neighbouring visual
1612
1875
 
1613
- Switch to \`align=left\` when the shape holds body copy - paragraphs,
1614
- bullet lists, numbered lists, blockquotes. Left-aligned reads better
1615
- once you have multiple lines. Keep \`valign=center\` (the default) so
1616
- the block floats in the middle of the shape; switch to \`valign=top\`
1617
- only when the shape is sized exactly to the content and you want it
1618
- anchored to the top.
1876
+ Switch to \`align=left valign=top\` when the shape holds body copy -
1877
+ paragraphs, bullet lists, numbered lists, blockquotes. Left-aligned
1878
+ reads better once you have multiple lines, and top-anchoring puts the
1879
+ first line just under the title where the reader looks first.
1880
+ Centering a list in an oversized box floats it toward the middle, so
1881
+ the gap under the title reads as a mistake. If top-anchoring leaves
1882
+ dead space below, shrink the shape - don't re-center the text.
1619
1883
 
1620
1884
  Rule of thumb:
1621
- ONE short phrase \u2192 leave centered
1622
- MULTIPLE lines \u2192 align=left, keep valign=center
1885
+ ONE short phrase / balancing block \u2192 center both axes
1886
+ MULTIPLE lines / bullets / columns \u2192 align=left valign=top
1887
+ Footer / attribution label \u2192 valign=bottom
1623
1888
 
1624
1889
  \u2500\u2500 PULLING FROM DOC STYLES \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1625
1890
  Slides pick up the host document's styles so a deck feels visually
@@ -1896,7 +2161,8 @@ navigate.
1896
2161
 
1897
2162
  Common errors:
1898
2163
  - "shape extends outside grid WxH" bbox past an edge by >10% of the
1899
- grid (a little bleed is allowed)
2164
+ grid. Add \`bleed=allow\` only when
2165
+ that individual shape is intentional
1900
2166
  - \`unknown id "@name"\` @-ref before the shape is declared
1901
2167
  - \`duplicate id "#name"\` two shapes share an id
1902
2168
  - \`invalid attribute key\` key must start with a letter
@@ -1910,10 +2176,10 @@ navigate.
1910
2176
  const SLIDES_CUSTOM_SHAPES_HELP = `
1911
2177
  SmallDocs — Slides (raw shapes)
1912
2178
  ===========================
1913
- Reference + design notes for slides built from raw shapes rather than
1914
- the stdlib templates. Most decks won't need any of this - if you can
1915
- express the slide via \`@extends\` on a built-in (cover, title-body,
1916
- two-column, exhibit, etc.), do that.
2179
+ Reference + design notes for slides built from raw shapes. Use templates
2180
+ for simple or repeated layouts. Use these shapes when geometry explains
2181
+ a process, architecture, hierarchy, comparison, or causal model, including
2182
+ in internal presentations.
1917
2183
 
1918
2184
  Read DESIGN PRINCIPLES first. The syntax reference below assumes you've
1919
2185
  made the visual choices the principles describe. Without them, raw
@@ -2051,6 +2317,18 @@ rather than as designed.
2051
2317
  overlay text on a single patch of colour (or very closely
2052
2318
  related colours) to keep it straightforwardly legible.
2053
2319
 
2320
+ Attempt to verify what you cannot see.
2321
+ The principles above guide the layout, but a hand-placed shape
2322
+ can still cover text, a label can wrap, or an arrow can miss its
2323
+ target, and none of it shows in the source. If you can drive a
2324
+ headless browser or any screenshot tool in your environment,
2325
+ render the deck and fix what you see before trusting it. If you
2326
+ cannot, it is worth raising with your user - for example, "I
2327
+ would like to use Playwright to verify the slides render
2328
+ correctly, is that okay?" - since a quick render check catches
2329
+ problems the markdown cannot show. See the VERIFYING A DECK
2330
+ section of \`sdoc slides\` for what to look for.
2331
+
2054
2332
  ── SHAPE KINDS ───────────────────────────────────────
2055
2333
  r x y w h rectangle (x,y = top-left; w,h = size)
2056
2334
  i x y w h image rect (sugar for \`r\` with \`image=\`; see IMAGES)
@@ -2215,7 +2493,8 @@ rather than as designed.
2215
2493
  All shapes EXCEPT \`l\` and \`a\` can hold markdown after \`|\` - full
2216
2494
  markdown (headings, lists, bold/italic, code, blockquote, tables).
2217
2495
  Non-rectangle shapes use their bounding box as the text area (see
2218
- the TEXT INSIDE NON-RECT SHAPES section).
2496
+ the TEXT INSIDE NON-RECT SHAPES section). In a short inline label,
2497
+ \`\\n\` inserts a visible line break.
2219
2498
 
2220
2499
  No \`fill=\` on a shape -> transparent (slide background shows through).
2221
2500
  Color values accept any CSS colour: hex (#1e40af), named (tomato),
@@ -2394,6 +2673,8 @@ rather than as designed.
2394
2673
  backdrops, ghosted "previous state" shapes,
2395
2674
  overlapping highlights. Out-of-range values
2396
2675
  clamp.
2676
+ bleed=allow Acknowledge intentional off-canvas overflow for
2677
+ this shape. Other shapes are still checked.
2397
2678
 
2398
2679
  Numeric attributes (strokeWidth, radius) are in grid units - pick
2399
2680
  values relative to your grid size, no prescribed defaults. On a
@@ -2644,14 +2925,8 @@ COMMANDS
2644
2925
  bag (tag - count, sorted by
2645
2926
  frequency). Run before tagging
2646
2927
  a new file to stay consistent.
2647
- sdoc library status Print enabled/disabled, entry
2648
- count, last scan time.
2649
-
2650
- Refresh
2651
- sdoc library rebuild Walk \$HOME again from scratch
2652
- and refresh every entry. Use
2653
- after moving files around or
2654
- when an entry seems stale.
2928
+ sdoc library status Print enabled/disabled and the
2929
+ current entry count.
2655
2930
 
2656
2931
  On/off
2657
2932
  sdoc library enable Re-enable indexing-on-open if
@@ -2684,9 +2959,7 @@ COMMANDS
2684
2959
  sdoc library help Same.
2685
2960
 
2686
2961
  WHAT GETS INDEXED
2687
- Every file you open with \`sdoc <file>\` is recorded at open time.
2688
- \`sdoc library rebuild\` additionally walks \$HOME looking for
2689
- markdown that fits these rules:
2962
+ Every file you open with \`sdoc <file>\` is recorded at open time when:
2690
2963
  - extension is .md, .mdx, or .markdown
2691
2964
  - size is at most 1 MB
2692
2965
  - not under a hidden directory (.git, .venv, .cache, ...)
@@ -2860,8 +3133,8 @@ PRIVACY MODEL
2860
3133
 
2861
3134
  COMMON QUESTIONS
2862
3135
  Q: I opened a file but I don't see it in the library.
2863
- A: Check \`sdoc library status\` (is it enabled?), then
2864
- \`sdoc library rebuild\`. If the file is in front matter
3136
+ A: Check \`sdoc library status\` (is it enabled?), then open the file
3137
+ again with \`sdoc <file>\`. If the file is in front matter
2865
3138
  \`sdocs-library: false\`, that's the opt-out. Also check for a
2866
3139
  .sdocsignore in the file's directory or any ancestor.
2867
3140
 
@@ -2931,6 +3204,23 @@ ANNOTATIONS (walk someone through the code)
2931
3204
  an agent explaining code to the reader; the in-browser comment mode
2932
3205
  (--comment) is the reverse - the reader's own review notes.
2933
3206
 
3207
+ Annotations render as a WALKTHROUGH: the file opens in the fullscreen viewer
3208
+ with each note carrying a Prev / Next stepper, so the reader is guided from
3209
+ one note to the next (arrow keys work too; a restart button returns to the
3210
+ start). The steps follow the ORDER YOU PASS THEM, not line order:
3211
+
3212
+ sdoc app.py 10:"start here" 5:"then jump back up here"
3213
+
3214
+ walks to line 10 first, then line 5.
3215
+
3216
+ Pass several files to narrate across them - each becomes a tab, and a step
3217
+ in another file switches to its tab as you walk (a small "-> file" marker
3218
+ shows when a step crosses files):
3219
+
3220
+ sdoc app.py 5:"entry point" util.py 12:"it calls into here" app.py 9:"back"
3221
+
3222
+ Naming a file twice gives one tab; the walk still hops between them in order.
3223
+
2934
3224
  COMMENTS
2935
3225
  Comments are deliberately prominent - italic, full-contrast colour, a faint
2936
3226
  tint - rather than the usual muted grey, so the human explanation in a
@@ -2947,4 +3237,4 @@ SUPPORTED LANGUAGES
2947
3237
  they appear. An unknown language label renders as plain text.
2948
3238
  `;
2949
3239
 
2950
- module.exports = { HELP, COMMENTS_HELP, SCHEMA, CHARTS_HELP, DIAGRAMS_HELP, VIDEOS_HELP, CELLS_HELP, CODE_HELP, SLIDES_HELP, SLIDES_CUSTOM_SHAPES_HELP, LIBRARY_HELP };
3240
+ module.exports = { HELP, COMMENTS_HELP, SCHEMA, CHARTS_HELP, DIAGRAMS_HELP, VIDEOS_HELP, APPS_HELP, CELLS_HELP, CODE_HELP, SLIDES_HELP, SLIDES_CUSTOM_SHAPES_HELP, LIBRARY_HELP };