sdocs-dev 1.2.0 → 1.3.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/public/sdoc.md ADDED
@@ -0,0 +1,542 @@
1
+ ---
2
+ file: sdoc.md
3
+ ---
4
+
5
+ # Meet `sdoc`: A markdown-first cli-native replacement for Word & GDocs
6
+
7
+
8
+ (**TLDR:** `sdoc path/to/README.md` opens your file at https://sdoc.dev with pleasant default styles which can be altered. Share the url to share your file + custom styling. **Your file never hits the SDocs server:** Encoded file content lives in the URL fragment (`#...` part) which browsers don't send to servers. CLI: `npm i -g sdocs-dev`. SDocs is [open-source](https://github.com/JoshInLisbon/SDocs). You're reading markdown right now.)
9
+
10
+ ---
11
+
12
+ If you're working with agents, a document written in markdown is <ins>officially</ins>* 407 times more useful than a document locked inside a `.docx` or `.gdoc` file format. Because of this, I believe Word and GDocs' days are numbered. (*I am the official.)
13
+
14
+ But while markdown is great for agents, it's a bit annoying for humans. Quickly and elegantly reading a `.md` file requires you to open your code editor and enter "preview" mode. Sharing a markdown file requires you to actually send the file to someone. They then have to download it and find the least annoying way to read it.
15
+
16
+ SmallDocs is an [open-source](https://github.com/JoshInLisbon/SDocs) attempt at something different. It lets you (or your agent) easily, elegantly and <ins>100% privately</ins> **read**, **format**, **share** and **export** `.md` files.
17
+
18
+ Reading a `.md` file in SmallDocs feels just like this (you're reading markdown right now). And by playing with the styles, you can create things like:
19
+
20
+ ![Examples](https://sdocs.dev/public/images/examples.png)
21
+
22
+ (Check out: [Slow Reading](https://sdocs.dev/#md=jZTdbuNGDIXv9RQHykWBrS1Ijp04LlAgSRF021wEmwC5piRKM_BoqJ0ZxdAWBfoQfcI-STFSfnc3Re8MknN4-JHycrlMgg6Gd0jvFOPcBUiDWyMHfGKqtW3TxIfRsN8lQCM2XFGnzbhDei2O0gQoyfOV2HCrv_AOxTYBjLb8K-tWhR2K7CwBFFPNzu_wx1uRG0NjQ9rhF-17Q2O6gK8o-im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AuDcYEi0VFrreemDTIe9_rsKUmb2Zq2r7hLwuw86f38huSHovgi7B5ifhqwTrqKS3qPEgjuSUKW3XauX8ikoyqNm6AyXgIE01Dev_AdA_p115ALMoHPvSW0LTl52X9jNBxjh-VMzi0BA-3tcUNo5VjpWEZy44s_vkTTC9nvZZ7wJP9-kTBMsv8B&theme=light))
23
+
24
+ Creating a SmallDoc for a `.md` file (+ automatically opening your browser to read it) is as simple as:
25
+
26
+ ```
27
+ # npm i -g sdocs-dev
28
+ sdoc README.md # open styled in browser
29
+ sdoc share README.md # copy shareable link to clipboard
30
+ ```
31
+
32
+ #### Claude Code + SDocs
33
+
34
+ Teach [Claude Code](https://docs.anthropic.com/en/docs/claude-code) about `sdoc` so it can read, style, and share `.md` files across all your projects:
35
+
36
+ ```bash
37
+ npm i -g sdocs-dev
38
+ cat >> ~/.claude/CLAUDE.md << 'SDOC'
39
+
40
+ ## SDocs
41
+
42
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
43
+ Content lives in the URL hash — nothing hits a server.
44
+
45
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
46
+
47
+ The `sdoc` CLI is installed globally:
48
+ - `sdoc file.md` — open styled in browser (great for easy reading).
49
+ - `sdoc share file.md` — copy shareable URL to clipboard.
50
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
51
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
52
+ - `sdoc --help` — full usage.
53
+
54
+ Source: https://github.com/JoshInLisbon/SDocs
55
+ SDOC
56
+ ```
57
+
58
+ #### Codex + SDocs
59
+
60
+ Teach [Codex](https://developers.openai.com/codex) about `sdoc`:
61
+
62
+ ```bash
63
+ npm i -g sdocs-dev
64
+ cat >> ~/.codex/AGENTS.md << 'SDOC'
65
+
66
+ ## SDocs
67
+
68
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
69
+ Content lives in the URL hash — nothing hits a server.
70
+
71
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
72
+
73
+ The `sdoc` CLI is installed globally:
74
+ - `sdoc file.md` — open styled in browser (great for easy reading).
75
+ - `sdoc share file.md` — copy shareable URL to clipboard.
76
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
77
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
78
+ - `sdoc --help` — full usage.
79
+
80
+ Source: https://github.com/JoshInLisbon/SDocs
81
+ SDOC
82
+ ```
83
+
84
+ #### Gemini CLI + SDocs
85
+
86
+ Teach [Gemini CLI](https://github.com/google-gemini/gemini-cli) about `sdoc`:
87
+
88
+ ```bash
89
+ npm i -g sdocs-dev
90
+ cat >> ~/.gemini/GEMINI.md << 'SDOC'
91
+
92
+ ## SDocs
93
+
94
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
95
+ Content lives in the URL hash — nothing hits a server.
96
+
97
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
98
+
99
+ The `sdoc` CLI is installed globally:
100
+ - `sdoc file.md` — open styled in browser (great for easy reading).
101
+ - `sdoc share file.md` — copy shareable URL to clipboard.
102
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
103
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
104
+ - `sdoc --help` — full usage.
105
+
106
+ Source: https://github.com/JoshInLisbon/SDocs
107
+ SDOC
108
+ ```
109
+
110
+ #### opencode + SDocs
111
+
112
+ Teach [opencode](https://opencode.ai) about `sdoc`:
113
+
114
+ ```bash
115
+ npm i -g sdocs-dev
116
+ mkdir -p ~/.config/opencode
117
+ cat >> ~/.config/opencode/AGENTS.md << 'SDOC'
118
+
119
+ ## SDocs
120
+
121
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
122
+ Content lives in the URL hash — nothing hits a server.
123
+
124
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
125
+
126
+ The `sdoc` CLI is installed globally:
127
+ - `sdoc file.md` — open styled in browser (great for easy reading).
128
+ - `sdoc share file.md` — copy shareable URL to clipboard.
129
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
130
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
131
+ - `sdoc --help` — full usage.
132
+
133
+ Source: https://github.com/JoshInLisbon/SDocs
134
+ SDOC
135
+ ```
136
+
137
+ ## How SmallDocs work
138
+
139
+ ### URLs
140
+
141
+ The URL format for SmallDocs is:
142
+
143
+ ```
144
+ https://sdocs.dev/#md={compressed & encoded .md}
145
+ ```
146
+
147
+ Your entire document (content and styles) lives in the URL hash.
148
+
149
+ To keep URLs as short as possible, SmallDocs compresses your markdown using [Brotli](https://en.wikipedia.org/wiki/Brotli) (a compression algorithm developed by Google, loaded via a small WebAssembly module) and then encodes the result with [base64url](https://en.wikipedia.org/wiki/Base64#URL_applications) (a URL-safe variant of base64 that avoids characters like `+`, `/`, and `=` which would otherwise need percent-encoding). Style properties that match built-in defaults (e.g. `fontFamily: Inter`, `baseFontSize: 16`) are omitted from the URL — only values that differ from defaults are included.
150
+
151
+ The `mode` parameter controls which view opens. Valid values are `read` (clean reading view, style panel hidden), `style` (style panel visible), and `raw` (raw markdown editor). When sharing a link for someone to read, use `mode=read`:
152
+
153
+ ```
154
+ https://sdocs.dev/#md=...&mode=read
155
+ ```
156
+
157
+ You can also link directly to a section using the `sec` parameter. Click any heading's link icon to copy its section URL:
158
+
159
+ ```
160
+ https://sdocs.dev/#md=...&sec=url-formatting
161
+ ```
162
+
163
+ The `sec` value is the heading text slugified (lowercased, spaces become hyphens, special characters stripped). The page will scroll to that section on load.
164
+
165
+ The `theme` parameter forces a specific theme: `theme=light` or `theme=dark`. This is useful when sharing a link where the document looks best in a particular theme. The override is view-only — it applies for that view but won't change the reader's saved theme preference.
166
+
167
+ ### Privacy
168
+
169
+ Because the SmallDocs url format is:
170
+
171
+ ```
172
+ https://sdocs.dev/#md={compressed & encoded .md}
173
+ ```
174
+
175
+ Your document never hits the SDocs server.
176
+
177
+ This layer of privacy is built into how HTTP works. The hash fragment (everything after the `#` in a URL) is never sent to the server by the browser. It always stays entirely client-side:
178
+
179
+ > "The fragment is not sent to the server when the URI is requested; it is processed by the client" - [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment)
180
+
181
+ The [sdocs.dev](https://sdocs.dev) site is purely a rendering space. JavaScript reads `window.location.hash`, decompresses and decodes the content, and renders your `.md` locally.
182
+
183
+ ### Formatting
184
+
185
+ SDocs adds basic styling to markdown files. You write your content in regular markdown and the styles live in a metadata block at the top of the file.
186
+
187
+ That metadata block is called [YAML front matter](https://jekyllrb.com/docs/front-matter/). It's a convention that started with [Jekyll](https://jekyllrb.com/) (the static site generator) back in 2008 and has since been adopted by [Hugo](https://gohugo.io/), [Gatsby](https://www.gatsbyjs.com/), [Obsidian](https://obsidian.md/), and most of the markdown ecosystem. It looks like a block of key-value pairs between two `---` lines at the top of your file:
188
+
189
+ ```yaml
190
+ ---
191
+ title: My Document
192
+ author: Someone
193
+ ---
194
+ ```
195
+
196
+ SDocs uses a `styles:` key with CSS properties written beneath it in YAML:
197
+
198
+ ```yaml
199
+ ---
200
+ styles:
201
+ fontFamily: Lora
202
+ baseFontSize: 17
203
+ h1: { fontSize: 2.3, fontWeight: 700 }
204
+ p: { lineHeight: 1.9, marginBottom: 1.2 }
205
+ ...
206
+ ---
207
+ ```
208
+
209
+ (Click "**Raw**" — top left — to see the front matter for this file. See all available properties [here](https://sdocs.dev) or by running `npm i sdocs-dev; sdoc schema`.)
210
+
211
+ When a `Styled .md` file is rendered in the SmallDocs interface the specified styles are applied. If a plain `.md` file is rendered the default styles are applied. The fastest way to preview a styled `.md` file is with the CLI: `sdoc file.md`.
212
+
213
+ #### Light & dark modes
214
+
215
+ Colors set at the top level are light-mode colors. Dark mode is **auto-generated** by inverting lightness — light backgrounds become dark, dark text becomes light, same hue and warmth. You only need to set colors once:
216
+
217
+ ```
218
+ background: "#fffaf5"
219
+ color: "#1a1a2e"
220
+ h1: { color: "#c0392b" }
221
+ blocks:
222
+ background: "#faf0eb"
223
+ ```
224
+
225
+ To override specific dark-mode colors, add a `dark:` block:
226
+
227
+ ```
228
+ dark:
229
+ background: "#1a1520"
230
+ h1: { color: "#ef6f5e" }
231
+ ```
232
+
233
+ Colors cascade from general to specific — set `color` once and it flows to headings, paragraphs, and lists. Set `blocks.background` once and it flows to code blocks, blockquotes, and charts.
234
+
235
+ ### Charts
236
+
237
+ Render charts in markdown using ` ```chart ` code blocks with JSON data. Charts are powered by Chart.js, loaded lazily from CDN only when a chart block is present.
238
+
239
+ ```chart
240
+ {"type":"bar","title":"Quarterly Revenue ($M)","labels":["Q1","Q2","Q3","Q4"],"datasets":[{"label":"2024","values":[12,18,15,22]},{"label":"2025","values":[15,24,20,28]}],"format":"currency"}
241
+ ```
242
+
243
+ ```chart
244
+ {"type":"pie","title":"Market Share","labels":["Chrome","Safari","Firefox","Edge","Other"],"values":[65,19,4,4,8]}
245
+ ```
246
+
247
+ The JSON for the bar chart above:
248
+
249
+ ````
250
+ ```chart
251
+ {
252
+ "type": "bar",
253
+ "title": "Quarterly Revenue ($M)",
254
+ "labels": ["Q1", "Q2", "Q3", "Q4"],
255
+ "datasets": [
256
+ { "label": "2024", "values": [12, 18, 15, 22] },
257
+ { "label": "2025", "values": [15, 24, 20, 28] }
258
+ ],
259
+ "format": "currency"
260
+ }
261
+ ```
262
+ ````
263
+
264
+ Supports 13 chart types: pie, doughnut, bar, horizontal bar, stacked bar, line, area, stacked area, radar, polar area, scatter, bubble, and mixed (combo). See the [full chart gallery](https://sdocs.dev/#md=G8UnAKyOt00DlHxWwjviQk58bNCHEZLMXjp1Z5n-3q1jp40U95IpNFHcxOkFh_Y1qbAHS6AbpMeoS_XEWiiA0suU-rzqL37KktMl6bZ160MSNPnhJPlKXrJ09TWLjkJX_7-1L8-6qsGeYTkr162RG2AVGeFzfLpeve6p1_V_D3CAqW91fVzCH2JFLAlUp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jAnl88mpuLxRljis2iknh_Vks_rdQvJI3lnxJ3CKZMpmZppL_K4m1v6Kewo6n-3NyBRwOh8MhgHJFyq8fdAJ2MPWOawad48xBd4LkUbf5kfwKRe1zr3OhtkorGPjF6dHHgbGbo5TqIJznaXAslG-G3cXSJ1fHgHtd8rSwhXXxyazphlr3ASvFq5ak7z1MJ-pDiNY-0AV9oQvqXO8q9SajpHWMYoSd0x7lRaiqxECQKkAF-MlVRKbLVO9Y_e0YBKkrRdFyk-63Acr8r_Par-fk4zNv4ysQdeyYrqg2y-86yGx7NLhBDSJud3i-4QG2KcD25wCEvfAY6eU6tdI87bnE05Bantv9KIVJdqbLVQbaQ_RtrUxarCQPLGtRVx9lrSt9MPCsLiajyQ_VxCHG8sFLjIzC0VuH5HRWZEWEJBeKtEu9gMMh0AWOut3QqiiD5j_owFsrWmMj0S4QiM2d8DimqQP4HRUn82wHPvH_VZq1oWRGXoCamq9pMXXHjctQyQCjCvY1rdqYW4HWWK2RFrtze25Mbdf0VurlZUOtS5cm2m7tfm2JbS4PIL08339eUWLhaNR9XcIukvT25yqELbQejcnb2dvPETgwJF4PkC_51mHY42hCCU0oIeRGSa388pcqKFYEt5q0oypb1DpSwIbf-_EZuKoO4yuVisSjHOlUGzB2q8OD04m0oi7lwRNva_wC2-10pqQjqbPcWXX3lt_XEGMsSow2Usgsfxr41vupbNiKIVvJ4uFtTD8iG8NmNszKdvuTWzWmzN0SChAQEBCoNZfM6xIKEBAQEKizicD5WLVHAXgwo7AvoKFhsbN8qzYO2RscCrgP6jxADvydlUyh_bwFIecm-d18mXV6CBAXTz2DpPojQax0AQ) for live examples of every type.
265
+
266
+ Style chart colors via `chart.accent` and `chart.palette` in front matter. Run `sdoc charts` for the full reference of types, options, and styling.
267
+
268
+ ### Drag & drop
269
+
270
+ Drag any `.md` file onto the editor to SmallDoc it instantly. Or from the terminal: `sdoc file.md`.
271
+
272
+ ### Exports
273
+
274
+ #### Raw .md
275
+
276
+ Your markdown content with all front matter stripped. Plain markdown, compatible with anything.
277
+
278
+ #### PDF
279
+
280
+ A styled PDF with selectable text, generated client-side.
281
+
282
+ #### Word (.docx)
283
+
284
+ A styled Word document generated from the rendered HTML.
285
+
286
+ #### Styled .md
287
+
288
+ Your markdown with the `styles:` front matter block included. This is the format SmallDocs reads back in, so your formatting is preserved.
289
+
290
+ ### Collapsed headers
291
+
292
+ All sections (H2, H3, H4) load collapsed. This gives you an overview of the document structure before reading.
293
+
294
+ Clicking a heading expands its section and all of its children. Clicking again collapses everything back.
295
+
296
+ When a section has both direct content (paragraphs, code blocks) and child sub-sections, the collapsed state shows `...` to indicate there is content above the first child heading. For example, the Formatting section in this document shows `...` when collapsed because it has introductory paragraphs before the Light & dark modes sub-section.
297
+
298
+ If you expand a child section while its parent is still collapsed, the parent's direct content becomes visible but is shown indented and subdued (reduced opacity) — so you can see the context without it competing visually with the section you opened.
299
+
300
+ ### Copy & paste
301
+
302
+ Every header has its own copy and paste button. This copies its content and all of its children's content. At the moment this is the fastest way to get SmallDoc content into your agent's context, but we're looking for novel ideas to make this better.
303
+
304
+ ### Works offline
305
+
306
+ SDocs uses a [service worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) to cache all assets (HTML, CSS, JS, fonts) in the browser. After your first visit, the site loads entirely from this cache — no network required. You can open SDocs URLs and edit documents while offline.
307
+
308
+ On each visit, the service worker sends a single request to `/version-check` in the background. This compares the cached app version against the server's current version. If they differ, the cache is purged and fresh assets are fetched — the update takes effect on your next page load. If the request fails (e.g. you're offline), nothing happens and the cached version continues to work.
309
+
310
+ ### Analytics
311
+
312
+ We don't use any third-party analytics provider.
313
+
314
+ The `/version-check` request described in the works offline section above is the only request SDocs makes to the server. Like any HTTP request, it includes your IP address, browser user-agent, referring URL, and the timestamp — this is standard to how the web works and is not something we add. The server logs these fields to stdout (a `console.log` line per visit, stored in the server's systemd journal).
315
+
316
+ In addition to these standard fields, the version-check request includes your **cohort week** — the week you first visited SDocs. This is stored in your browser's localStorage under the key `sdocs_cohort`. For example, if you first visit on 2026-04-10, the value `2026-W15` is stored and sent with each subsequent version-check.
317
+
318
+ This is not a unique identifier. It groups you with every other person who first visited that same week. A scheduled job aggregates the journal logs into weekly cohort counts in a local database — "of everyone who first visited in week 15, how many came back in week 16, 17, etc." The results are public at [sdocs.dev/analytics](https://sdocs.dev/analytics).
319
+
320
+ We track retention because it is the strongest signal for whether a tool is useful.
321
+
322
+ To opt out, there is a toggle in the top menu bar. You can also remove `sdocs_cohort` from localStorage in your browser's developer tools, or use a private browsing window.
323
+
324
+ ### Auto-save
325
+
326
+ Because the URL includes your full document and dynamically updates via JavaScript, every change you make is instantly preserved in the URL. This works when you're offline.
327
+
328
+ ### File info card
329
+
330
+ When you run `sdoc <file>` the browser shows a small info card at the top of the rendered document. It can carry three fields:
331
+
332
+ - **file** — the filename. Lives in the YAML front matter and travels in the share URL.
333
+ - **path** — the relative path from the directory you ran `sdoc` in. *Local only.*
334
+ - **fullPath** — the absolute path on your machine. *Local only.*
335
+
336
+ The two "local" fields are passed to the browser via a separate URL parameter (`&local=...`) that JavaScript reads into memory on load and immediately strips from the address bar using `history.replaceState`. So by the time you could copy the URL, the local data is no longer in it. `sdoc share <file>` never generates that parameter to begin with — so links produced by `share` are inherently path-free. If a recipient opens your shared URL, only `file` is visible.
337
+
338
+ ## The CLI
339
+
340
+ ### Installation
341
+
342
+ SmallDocs has a command-line tool that lets you open, share, and style markdown files from the terminal. Install it once:
343
+
344
+ ```
345
+ npm i -g sdocs-dev
346
+ ```
347
+
348
+ This gives you the `sdoc` command.
349
+
350
+ ### Open a file
351
+
352
+ ```
353
+ sdoc README.md
354
+ ```
355
+
356
+ Your browser opens with the document styled and readable. That's it — one command to go from `.md` file to formatted document.
357
+
358
+ ### Share a link
359
+
360
+ ```
361
+ sdoc share README.md
362
+ ```
363
+
364
+ This copies a shareable link to your clipboard.
365
+
366
+ You can also combine it with options:
367
+
368
+ ```
369
+ sdoc share report.md --section "Results" # deep-link to a heading
370
+ sdoc share notes.md --write # link opens in write mode
371
+ sdoc share notes.md --dark # link opens in dark theme
372
+ ```
373
+
374
+ ### Start a new document
375
+
376
+ ```
377
+ sdoc new
378
+ ```
379
+
380
+ Opens a blank document in write mode, ready to type a `h1`.
381
+
382
+ ### Style schema
383
+
384
+ ```
385
+ sdoc schema
386
+ ```
387
+
388
+ Prints every available style property with its type, default value, and description. This is designed to be readable by both humans and LLMs — so your agent can write YAML front matter for you.
389
+
390
+ ### Chart options
391
+
392
+ ```
393
+ sdoc charts
394
+ ```
395
+
396
+ Prints the full chart reference: all 13 chart types, JSON data formats, axis options, number formatting, annotations, dual y-axis, palette modes, and styling via front matter. Everything an agent needs to generate charts.
397
+
398
+ ### Modes
399
+
400
+ By default, files open in read mode. You can open in any mode:
401
+
402
+ ```
403
+ sdoc README.md # read mode (default)
404
+ sdoc README.md --write # write mode (contentEditable editor)
405
+ sdoc README.md --style # style mode (styling panel visible)
406
+ sdoc README.md --raw # raw mode (plain markdown source)
407
+ ```
408
+
409
+ ### Pipe from stdin
410
+
411
+ Any command that outputs markdown can be piped directly into SmallDocs:
412
+
413
+ ```
414
+ cat notes.md | sdoc # open in browser
415
+ cat notes.md | sdoc share # pipe to clipboard link
416
+ your-agent --output md | sdoc # pipe agent output to browser
417
+ ```
418
+
419
+ ### Default styles
420
+
421
+ If you find a style you like, use the "Save as Default" panel in the Style view to generate a command that saves your preferences to `~/.sdocs/styles.yaml`. The CLI automatically applies these defaults to every file you open — unless the file has its own styles, which always take priority.
422
+
423
+ ```
424
+ sdoc defaults # view your current defaults
425
+ sdoc defaults --reset # remove them
426
+ ```
427
+
428
+ ### For agents
429
+
430
+ The CLI is designed to work well in automated workflows. A few patterns:
431
+
432
+ - **Generate a styled doc**: have your agent write a `.md` file with YAML front matter, then `sdoc share file.md` to copy a shareable link
433
+ - **Learn the format**: `sdoc schema` gives your agent everything it needs to know about available style properties
434
+ - **Learn charts**: `sdoc charts` gives the full reference of chart types, options, data formats, and styling
435
+ - **Deep-link to context**: `sdoc share file.md --section "Heading"` creates a URL that scrolls straight to the relevant section
436
+ - **No auth, no API keys**: everything is client-side — the URL *is* the document
437
+
438
+ Agents can get detailed help on any topic via the CLI:
439
+
440
+ ```
441
+ sdoc help # general usage
442
+ sdoc schema # all style properties, color cascade, theme format
443
+ sdoc charts # chart types, JSON format, styling, annotations
444
+ ```
445
+
446
+ ### Set up your agent
447
+
448
+ One-line commands to teach your coding agent about `sdoc`. Each appends SDocs instructions to the tool's global config file. Copy and paste into your terminal.
449
+
450
+ #### Claude Code → `~/.claude/CLAUDE.md`
451
+
452
+ ```bash
453
+ cat >> ~/.claude/CLAUDE.md << 'SDOC'
454
+
455
+ ## SDocs
456
+
457
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
458
+ Content lives in the URL hash — nothing hits a server.
459
+
460
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
461
+
462
+ The `sdoc` CLI is installed globally:
463
+ - `sdoc file.md` — open styled in browser (great for easy reading).
464
+ - `sdoc share file.md` — copy shareable URL to clipboard.
465
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
466
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
467
+ - `sdoc --help` — full usage.
468
+
469
+ Source: https://github.com/JoshInLisbon/SDocs
470
+ SDOC
471
+ ```
472
+
473
+ #### Codex → `~/.codex/AGENTS.md`
474
+
475
+ ```bash
476
+ cat >> ~/.codex/AGENTS.md << 'SDOC'
477
+
478
+ ## SDocs
479
+
480
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
481
+ Content lives in the URL hash — nothing hits a server.
482
+
483
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
484
+
485
+ The `sdoc` CLI is installed globally:
486
+ - `sdoc file.md` — open styled in browser (great for easy reading).
487
+ - `sdoc share file.md` — copy shareable URL to clipboard.
488
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
489
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
490
+ - `sdoc --help` — full usage.
491
+
492
+ Source: https://github.com/JoshInLisbon/SDocs
493
+ SDOC
494
+ ```
495
+
496
+ #### Gemini CLI → `~/.gemini/GEMINI.md`
497
+
498
+ ```bash
499
+ cat >> ~/.gemini/GEMINI.md << 'SDOC'
500
+
501
+ ## SDocs
502
+
503
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
504
+ Content lives in the URL hash — nothing hits a server.
505
+
506
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
507
+
508
+ The `sdoc` CLI is installed globally:
509
+ - `sdoc file.md` — open styled in browser (great for easy reading).
510
+ - `sdoc share file.md` — copy shareable URL to clipboard.
511
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
512
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
513
+ - `sdoc --help` — full usage.
514
+
515
+ Source: https://github.com/JoshInLisbon/SDocs
516
+ SDOC
517
+ ```
518
+
519
+ #### opencode → `~/.config/opencode/AGENTS.md`
520
+
521
+ ```bash
522
+ mkdir -p ~/.config/opencode
523
+ cat >> ~/.config/opencode/AGENTS.md << 'SDOC'
524
+
525
+ ## SDocs
526
+
527
+ SDocs (sdocs.dev) renders markdown with clean styling you can adjust.
528
+ Content lives in the URL hash — nothing hits a server.
529
+
530
+ Use it (or offer it) when the user wants to read, share, or export a `.md` file.
531
+
532
+ The `sdoc` CLI is installed globally:
533
+ - `sdoc file.md` — open styled in browser (great for easy reading).
534
+ - `sdoc share file.md` — copy shareable URL to clipboard.
535
+ - `sdoc schema` — how to adjust all stylable properties (fonts, colors, spacing).
536
+ - `sdoc charts` — chart types, JSON format, and styling. Charts render via Chart.js from ```chart code blocks.
537
+ - `sdoc --help` — full usage.
538
+
539
+ Source: https://github.com/JoshInLisbon/SDocs
540
+ SDOC
541
+ ```
542
+