sdocs-dev 1.14.0 → 1.14.1

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/bin/sdocs-dev.js CHANGED
@@ -47,6 +47,8 @@ function buildRouter() {
47
47
  r.register('schema', { handler: () => { console.log(helpText.SCHEMA); process.exit(0); } });
48
48
  r.register('charts', { handler: () => { console.log(helpText.CHARTS_HELP); process.exit(0); } });
49
49
  r.register('diagrams', { handler: () => { console.log(helpText.DIAGRAMS_HELP); process.exit(0); } });
50
+ r.register('videos', { handler: () => { console.log(helpText.VIDEOS_HELP); process.exit(0); } });
51
+ r.register('video', { handler: () => { console.log(helpText.VIDEOS_HELP); process.exit(0); } });
50
52
  // `sdoc cells` prints the reference; `sdoc cells verify <file>` evaluates a
51
53
  // document's tabs headlessly and prints the computed values (the handler
52
54
  // calls process.exit with the 0/1/2 result code).
package/lib/help-text.js CHANGED
@@ -21,6 +21,7 @@ USAGE
21
21
  sdoc schema Print the full styles schema
22
22
  sdoc charts Chart types, options, and styling guide
23
23
  sdoc diagrams Mermaid diagrams reference (\`\`\`mermaid blocks)
24
+ sdoc videos YouTube embed reference (\`\`\`video blocks)
24
25
  sdoc cells Inline spreadsheet reference (\`\`\`cells blocks)
25
26
  sdoc code Syntax highlighting + code-viewer reference
26
27
  sdoc app.rb / server.js / ... Open a source file as a highlighted listing
@@ -928,6 +929,55 @@ EXAMPLE
928
929
  `;
929
930
 
930
931
 
932
+ const VIDEOS_HELP = `
933
+ SmallDocs - Videos
934
+ ==================
935
+ Embed a YouTube video in markdown using a \`\`\`video fenced code block.
936
+ The body is a YouTube URL (any common shape) or a bare 11-character
937
+ video id, with optional \`title:\` and \`start:\` lines.
938
+
939
+ BASIC SYNTAX
940
+ \`\`\`video
941
+ https://www.youtube.com/watch?v=dQw4w9WgXcQ
942
+ \`\`\`
943
+
944
+ Bare id, short link, embed link and shorts link all work:
945
+ \`\`\`video
946
+ dQw4w9WgXcQ
947
+ \`\`\`
948
+
949
+ WITH A TITLE AND START TIME
950
+ \`\`\`video
951
+ https://youtu.be/dQw4w9WgXcQ
952
+ title: Our launch walkthrough
953
+ start: 1:30
954
+ \`\`\`
955
+ \`start:\` accepts seconds (90), clock (1:30, 1:02:03) or 1m30s / 1h2m3s.
956
+ A \`t=\` parameter already on the URL is used when no \`start:\` is given.
957
+ \`title:\` sets the iframe title (accessibility) and a caption link.
958
+
959
+ WHAT RENDERS
960
+ A responsive 16:9 player that scales with the body column. The embed
961
+ host is youtube-nocookie.com, so no tracking cookie is set until the
962
+ viewer presses play. \`rel=0\` is applied, which limits the end-screen
963
+ suggestions to the source channel (YouTube no longer allows fully
964
+ removing them from an embed).
965
+
966
+ LIMITS
967
+ - Per-block source cap: 8 KB.
968
+ - Per-document video cap: 50 (excess rendered as plain code).
969
+
970
+ SECURITY
971
+ No iframe ever travels through the document markup - SmallDocs still
972
+ strips iframes from ordinary markdown. The renderer reads only the
973
+ block text, extracts the 11-character video id, validates it against
974
+ \`[A-Za-z0-9_-]{11}\`, and builds the player from a src it constructs
975
+ itself. Anything that is not a recognised YouTube URL or a valid id
976
+ renders as an inline error, never an embed. Treat block source as
977
+ untrusted - it travels in the URL hash with the rest of the document.
978
+ `;
979
+
980
+
931
981
  const CELLS_HELP = `
932
982
  SmallDocs - Cells (sheets)
933
983
  ======================
@@ -1845,7 +1895,8 @@ navigate.
1845
1895
  errors + the full slide source — for pasting back to an agent.
1846
1896
 
1847
1897
  Common errors:
1848
- - "shape extends outside grid WxH" y+h > H (or x+w > W)
1898
+ - "shape extends outside grid WxH" bbox past an edge by >10% of the
1899
+ grid (a little bleed is allowed)
1849
1900
  - \`unknown id "@name"\` @-ref before the shape is declared
1850
1901
  - \`duplicate id "#name"\` two shapes share an id
1851
1902
  - \`invalid attribute key\` key must start with a letter
@@ -1969,6 +2020,37 @@ rather than as designed.
1969
2020
  default. Spend visual weight only on the one or two things the
1970
2021
  slide is about. Empty space is half the design.
1971
2022
 
2023
+ Text alignment.
2024
+ Except for slides with very few elements, or custom shapes with
2025
+ very few words, prefer left-aligned text throughout a slide.
2026
+ Left-aligning most elements - particularly any with more than
2027
+ three words - creates a calm, confident slide that is easy to
2028
+ follow.
2029
+
2030
+ An implicit grid.
2031
+ Take inspiration from Josef Muller-Brockmann's work on grid
2032
+ systems. Consistency of alignment between elements gives off the
2033
+ feeling of considered, structured thinking. Unless you are
2034
+ creating something specific from custom shapes, prefer to build
2035
+ an implicit grid on the slide. A presentation feels even more
2036
+ professional when that grid language flows from slide to slide.
2037
+
2038
+ Branding, borders and background.
2039
+ Less is often more. Precise layouts are hard with custom shapes:
2040
+ overlapping positions may not land where you expect, and you
2041
+ cannot easily check how the slide feels. So when you give a slide
2042
+ a mood through coloured background shapes, keep it relatively
2043
+ simple. This should not stop you being bold, but design with a
2044
+ few key shapes (which may overlap), not many overlapping ones.
2045
+
2046
+ Contrast and legibility.
2047
+ Consider the colour of text against the colour of whatever falls
2048
+ directly beneath it. Readers should be able to calmly take text
2049
+ in from a slide, so ensure there is healthy contrast, at least,
2050
+ between text and the colour beneath it. In general, try to
2051
+ overlay text on a single patch of colour (or very closely
2052
+ related colours) to keep it straightforwardly legible.
2053
+
1972
2054
  ── SHAPE KINDS ───────────────────────────────────────
1973
2055
  r x y w h rectangle (x,y = top-left; w,h = size)
1974
2056
  i x y w h image rect (sugar for \`r\` with \`image=\`; see IMAGES)
@@ -2069,6 +2151,12 @@ rather than as designed.
2069
2151
  so the layout doesn't reflow when
2070
2152
  icons swap in.
2071
2153
 
2154
+ Pair an icon with its label as two separate shapes - the icon in
2155
+ its own small box, the text in a shape beside or below it. Don't
2156
+ put \`|\` text on an icon (it overlaps the glyph) or drop an icon
2157
+ onto a text shape. Keep every icon in a set the same size (w = h)
2158
+ on a shared row.
2159
+
2072
2160
  Arrow geometry: the coordinates are the line's centerline. The head is
2073
2161
  symmetric around the line, extending up to 3 * strokeWidth perpendicular
2074
2162
  on each side. So a horizontal arrow at y=5.78 with strokeWidth=0.06
@@ -2279,6 +2367,18 @@ rather than as designed.
2279
2367
  The three cards then read as a parallel set rather than three
2280
2368
  improvisations.
2281
2369
 
2370
+ 5. Icons collide with text when they share a box.
2371
+
2372
+ The \`icon\` shape paints its glyph across its whole bbox, so
2373
+ text in the same box - or a text shape the icon sits on top of
2374
+ - overlaps it. Keep them as two shapes on one row:
2375
+
2376
+ icon 8 20 4 4 name=recycle color=#0165a5
2377
+ r 13 20 26 4 text=body align=left valign=center | Repairable by design
2378
+
2379
+ Icon in its own 4x4 box; the label starts after it at x=13,
2380
+ centred on the same y. Size every icon in a set the same.
2381
+
2282
2382
  ── SHAPE ATTRIBUTES ──────────────────────────────────
2283
2383
  Between geometry and \`|\`:
2284
2384
 
@@ -2847,4 +2947,4 @@ SUPPORTED LANGUAGES
2847
2947
  they appear. An unknown language label renders as plain text.
2848
2948
  `;
2849
2949
 
2850
- module.exports = { HELP, COMMENTS_HELP, SCHEMA, CHARTS_HELP, DIAGRAMS_HELP, CELLS_HELP, CODE_HELP, SLIDES_HELP, SLIDES_CUSTOM_SHAPES_HELP, LIBRARY_HELP };
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 };
package/lib/io.js CHANGED
@@ -8,7 +8,7 @@ const { isWrappedFile, wrapForDisplay } = require('./file-wrap');
8
8
 
9
9
  const SUBCOMMANDS = new Set([
10
10
  'new', 'share', 'schema', 'defaults', 'help', 'version',
11
- 'charts', 'diagrams', 'cells', 'code', 'comments',
11
+ 'charts', 'diagrams', 'videos', 'video', 'cells', 'code', 'comments',
12
12
  'setup', 'safe', 'auto-update', 'refresh', 'upgrade',
13
13
  'bridge', 'feedback',
14
14
  'slides', 'present',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdocs-dev",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "Open, share, and style markdown files from the terminal",
5
5
  "main": "bin/sdocs-dev.js",
6
6
  "bin": {