@entropicwarrior/sdoc 0.1.16 → 0.1.17
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 +6 -6
- package/docs/guide/intro.sdoc +112 -0
- package/docs/guide/notion-sync.sdoc +177 -0
- package/docs/guide/setup.sdoc +112 -0
- package/docs/index.sdoc +39 -0
- package/docs/reference/api.sdoc +208 -0
- package/docs/reference/cli.sdoc +188 -0
- package/{lexica → docs/reference}/sdoc-authoring.sdoc +95 -0
- package/docs/reference/syntax.sdoc +502 -0
- package/docs/tutorials/first-steps.sdoc +117 -0
- package/knowledge.js +10 -0
- package/llms.txt +4 -5
- package/package.json +1 -1
- /package/{lexica → docs/guide}/why-sdoc.sdoc +0 -0
- /package/{lexica → docs/reference}/slide-authoring.sdoc +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# CLI and Tools Reference
|
|
2
|
+
{
|
|
3
|
+
@meta {
|
|
4
|
+
sdoc-version: 0.1
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
# VSCode Extension Commands
|
|
8
|
+
{
|
|
9
|
+
The SDOC extension registers eight commands, available from the Command Palette:
|
|
10
|
+
|
|
11
|
+
{[.]
|
|
12
|
+
- **SDOC: Open Preview** (`sdoc.preview`) -- opens a rendered preview of the current `.sdoc` file
|
|
13
|
+
- **SDOC: Open Preview to the Side** (`sdoc.previewToSide`) -- opens the preview in a side pane
|
|
14
|
+
- **SDOC: Export HTML** (`sdoc.exportHtml`) -- exports the current document as a standalone HTML file
|
|
15
|
+
- **SDOC: Export PDF** (`sdoc.exportPdf`) -- exports the current document as an A4 PDF via headless Chrome
|
|
16
|
+
- **SDOC: Open in Browser** (`sdoc.openInBrowser`) -- opens the current document in the system browser
|
|
17
|
+
- **SDOC: Browse Documents** (`sdoc.browseDocs`) -- starts a local document server and opens the viewer in a browser
|
|
18
|
+
- **SDOC: New Knowledge File** (`sdoc.newKnowledgeFile`) -- creates a new `.sdoc` file from a template in the selected folder
|
|
19
|
+
- **SDOC: Generate About** (`sdoc.generateAbout`) -- generates an About section for the current document
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
The preview updates automatically when the source file changes or when a `sdoc.config.json` or `.css` file is saved.
|
|
23
|
+
|
|
24
|
+
# Format Document
|
|
25
|
+
{
|
|
26
|
+
Use **Format Document** (Shift+Option+F on macOS, Shift+Alt+F on Windows/Linux) to auto-indent the current `.sdoc` file based on brace depth. The formatter respects VS Code's tab size and spaces/tabs preference. Code blocks are left untouched.
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Export HTML
|
|
30
|
+
{
|
|
31
|
+
Exports the current SDOC document as a self-contained `.html` file. Works from the editor or the preview panel. The exported file includes all styles and supports collapsible scope toggles in the browser.
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Export PDF
|
|
35
|
+
{
|
|
36
|
+
Exports the current SDOC document as an A4 PDF. Works from the editor or the preview panel. Requires Google Chrome or Chromium installed on the system (or set the `CHROME_PATH` environment variable). The PDF uses print-optimized styles with correct font sizes and preserved marker colors.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Open in Browser
|
|
40
|
+
{
|
|
41
|
+
Opens the current SDOC document in the system's default browser. Works from the editor or the preview panel. A temporary HTML file is created and opened. Like Export HTML, the output supports collapsible toggles and printing.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Build Document Tool
|
|
46
|
+
{
|
|
47
|
+
`tools/build-doc.js` exports SDOC files to HTML or PDF from the command line.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
node tools/build-doc.js input.sdoc # PDF output (default)
|
|
51
|
+
node tools/build-doc.js input.sdoc -o output.pdf # PDF with custom path
|
|
52
|
+
node tools/build-doc.js input.sdoc --html # HTML output
|
|
53
|
+
node tools/build-doc.js input.sdoc --html -o out.html # HTML with custom path
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
# Options
|
|
57
|
+
{
|
|
58
|
+
{[.]
|
|
59
|
+
- `-o <path>` -- output file path (default: input name with `.pdf` or `.html` extension)
|
|
60
|
+
- `--html` -- export as HTML instead of PDF
|
|
61
|
+
- `--help` / `-h` -- show usage information and exit
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
PDF export requires Google Chrome or Chromium. Set the `CHROME_PATH` environment variable to override auto-detection. The output uses A4 page size with print-optimized styles.
|
|
66
|
+
|
|
67
|
+
The tool respects `sdoc.config.json` files in the directory hierarchy and per-file `@meta` style overrides, just like the VS Code extension.
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Notion Sync Tool
|
|
71
|
+
{
|
|
72
|
+
`tools/sync-notion.js` syncs SDOC files to Notion pages. See the [Notion Sync guide](../guide/notion-sync.sdoc) for full setup instructions.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
node tools/sync-notion.js <file-or-directory> [options]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
# Options
|
|
79
|
+
{
|
|
80
|
+
{[.]
|
|
81
|
+
- `--page-id <id>` -- override the Notion page ID (single-file mode only)
|
|
82
|
+
- `--token <tok>` -- Notion integration token (default: `$NOTION_TOKEN` env var)
|
|
83
|
+
- `--dry-run` -- render blocks to stdout without calling the Notion API
|
|
84
|
+
- `--verbose` -- print progress to stderr
|
|
85
|
+
- `--help` / `-h` -- show usage information and exit
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Examples
|
|
90
|
+
{
|
|
91
|
+
```bash
|
|
92
|
+
# Sync a single file (page ID from @meta)
|
|
93
|
+
node tools/sync-notion.js docs/architecture.sdoc --verbose
|
|
94
|
+
|
|
95
|
+
# Scan a directory for files with notion-page in @meta
|
|
96
|
+
node tools/sync-notion.js docs/ --verbose
|
|
97
|
+
|
|
98
|
+
# Dry run -- inspect the rendered Notion blocks
|
|
99
|
+
node tools/sync-notion.js docs/ --dry-run
|
|
100
|
+
|
|
101
|
+
# Override page ID (for testing)
|
|
102
|
+
node tools/sync-notion.js file.sdoc --page-id abc123def456
|
|
103
|
+
```
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Files opt in to sync by setting `notion-page: <page-id>` in their `@meta` scope. When given a directory, the tool scans recursively for `.sdoc` files with this property.
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
# npm Package
|
|
110
|
+
{
|
|
111
|
+
The parser, renderers, and knowledge files are published to npm as `@entropicwarrior/sdoc`:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install @entropicwarrior/sdoc
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
See the [API reference](api.sdoc) for available exports.
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# Building the Extension
|
|
121
|
+
{
|
|
122
|
+
```bash
|
|
123
|
+
npm install
|
|
124
|
+
npm run package
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This produces `dist/sdoc-<version>.vsix`. Install it with:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
code --install-extension dist/sdoc-<version>.vsix
|
|
131
|
+
```
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# Document Server
|
|
135
|
+
{
|
|
136
|
+
Two ways to browse all `.sdoc` files in a project with a local HTTP server:
|
|
137
|
+
|
|
138
|
+
# Python CLI
|
|
139
|
+
{
|
|
140
|
+
`tools/serve_docs.py` starts a local document server:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python3 tools/serve_docs.py # serve current dir on :4070
|
|
144
|
+
python3 tools/serve_docs.py docs/ -p 8080 # serve docs/ on :8080
|
|
145
|
+
python3 tools/serve_docs.py --no-open # don't auto-open browser
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
{[.]
|
|
149
|
+
- `source_dir` (positional, default: `.`) -- directory containing `.sdoc` files
|
|
150
|
+
- `-p` / `--port` -- port to serve on (default: `4070`)
|
|
151
|
+
- `--no-open` -- don't open the browser automatically
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
# VSCode Command
|
|
156
|
+
{
|
|
157
|
+
Run **SDOC: Browse Documents** from the Command Palette. A prompt asks whether to serve the entire workspace or a specific folder. The server starts on an available port (4070-4079) and opens the viewer in the browser.
|
|
158
|
+
|
|
159
|
+
While the server is running, running the command again offers "Open in Browser" or "Stop Server". A status bar item shows the active port.
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
# How It Works
|
|
163
|
+
{
|
|
164
|
+
The server serves files directly from the source directory -- no copying, no bundling. The manifest (file list, titles, configs, CSS) is computed fresh on each request, so edits are reflected on browser refresh.
|
|
165
|
+
|
|
166
|
+
{[.]
|
|
167
|
+
- `GET /` -- viewer UI (`src/site-template/index.html`)
|
|
168
|
+
- `GET /viewer.css` -- viewer styles
|
|
169
|
+
- `GET /sdoc-web.js` -- browser-side parser/renderer
|
|
170
|
+
- `GET /api/manifest` -- file list, titles, configs, CSS map
|
|
171
|
+
- `GET /api/content?path=<rel>` -- raw `.sdoc` file content (on demand)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
# Viewer Features
|
|
176
|
+
{
|
|
177
|
+
{[.]
|
|
178
|
+
- Sidebar with file tree navigation and search filtering
|
|
179
|
+
- Split-pane comparison (Shift+Click a second document)
|
|
180
|
+
- Collapsible sidebar with layout controls (single, split L/R, split T/B)
|
|
181
|
+
- Collapsible scopes (toggle triangles on scope headings, same as preview)
|
|
182
|
+
- Client-side rendering with the same parser as the extension
|
|
183
|
+
- Shadow DOM isolation for each document pane
|
|
184
|
+
- URL hash navigation (`#doc=path/to/file.sdoc`)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -84,6 +84,51 @@
|
|
|
84
84
|
document.
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
# Headingless Scopes @headingless-scopes
|
|
88
|
+
{
|
|
89
|
+
A bare \`{ }\` block without a heading creates a section with no title — useful for grouping content:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
{
|
|
93
|
+
This content is grouped but has no heading.
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Headingless scopes nest like any other scope and can appear anywhere a headed scope can.
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Inline Blocks @inline-blocks
|
|
101
|
+
{
|
|
102
|
+
Short content can be written on a single line:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
# Author
|
|
106
|
+
{ Jane Doe }
|
|
107
|
+
|
|
108
|
+
# Version
|
|
109
|
+
{ 1.0 }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Inline blocks must not contain unescaped \`{\` or \`}\` characters.
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Implicit Root @implicit-root
|
|
116
|
+
{
|
|
117
|
+
If the first heading is not followed by \`{\`, the document uses implicit root mode — the first heading becomes the document title and everything after it becomes the body:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
# My Document
|
|
121
|
+
|
|
122
|
+
# Section A
|
|
123
|
+
Content of Section A.
|
|
124
|
+
|
|
125
|
+
# Section B
|
|
126
|
+
Content of Section B.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This is equivalent to wrapping the entire body in braces after the first heading. Use implicit root for simple flat documents.
|
|
130
|
+
}
|
|
131
|
+
|
|
87
132
|
# Paragraphs @paragraphs
|
|
88
133
|
{
|
|
89
134
|
Consecutive text lines form a paragraph. A blank line or a new scope
|
|
@@ -134,6 +179,38 @@
|
|
|
134
179
|
**Important:** \`{[.]}\` with the closing brace on the same line creates an empty list — the brace closes the block immediately. Always put the closing \`}\` on a separate line after the items.
|
|
135
180
|
|
|
136
181
|
Implicit lists only work for bullet lists (\`-\`) where every item is a single line. For numbered lists, always use the explicit \`{[#]\` block form.
|
|
182
|
+
|
|
183
|
+
**Task lists** — checkbox syntax inside explicit list blocks:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
{[.]
|
|
187
|
+
- [ ] Pending task
|
|
188
|
+
- [x] Completed task
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Anonymous list items** — items with no title, just a body block:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
{[.]
|
|
196
|
+
{
|
|
197
|
+
First item, body only.
|
|
198
|
+
}
|
|
199
|
+
{
|
|
200
|
+
Second item, body only.
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Multi-line titles** — in explicit list blocks, item titles can span multiple lines. Continuation stops at blank lines, list markers, braces, and other command tokens:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
{[.]
|
|
209
|
+
- This is a long list item
|
|
210
|
+
that continues on the next line
|
|
211
|
+
- Short item
|
|
212
|
+
}
|
|
213
|
+
```
|
|
137
214
|
}
|
|
138
215
|
|
|
139
216
|
# Tables @tables
|
|
@@ -286,6 +363,15 @@
|
|
|
286
363
|
```
|
|
287
364
|
}
|
|
288
365
|
|
|
366
|
+
# Horizontal Rules @horizontal-rules
|
|
367
|
+
{
|
|
368
|
+
A line of three or more \`-\`, \`*\`, or \`_\`:
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
---
|
|
372
|
+
```
|
|
373
|
+
}
|
|
374
|
+
|
|
289
375
|
# Meta Scope @meta-scope
|
|
290
376
|
{
|
|
291
377
|
The reserved \`@meta\` scope configures per-file settings and is not rendered in the document body. Use the bare \`@meta\` form (preferred) or the heading form:
|
|
@@ -359,6 +445,15 @@
|
|
|
359
445
|
|
|
360
446
|
A line starting with \`\\#\` renders as a literal \`#\` (not a heading). Use \`\\\$\` to prevent a dollar sign from starting math mode.
|
|
361
447
|
}
|
|
448
|
+
|
|
449
|
+
# Conventions @conventions
|
|
450
|
+
{
|
|
451
|
+
{[.]
|
|
452
|
+
- **Indentation:** cosmetic — use any whitespace you like. Most authors use 4 spaces.
|
|
453
|
+
- **IDs:** lowercase kebab-case (\`@my-section\`). IDs should be unique within a document.
|
|
454
|
+
- **Commas:** commas between list items or scopes are allowed but ignored — use them if you find them readable.
|
|
455
|
+
}
|
|
456
|
+
}
|
|
362
457
|
}
|
|
363
458
|
|
|
364
459
|
# Common Mistakes @common-mistakes
|