@entropicwarrior/sdoc 0.1.3
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/LICENSE +21 -0
- package/README.md +110 -0
- package/index.js +2 -0
- package/package.json +165 -0
- package/src/notion-renderer.js +451 -0
- package/src/sdoc.js +2223 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Irreversible Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# SDOC
|
|
2
|
+
|
|
3
|
+
A plain-text documentation format designed for AI-agent efficiency. Explicit brace scoping means deterministic parsing, surgical section extraction, and 10-50x token savings compared to Markdown.
|
|
4
|
+
|
|
5
|
+
## Why SDOC?
|
|
6
|
+
|
|
7
|
+
- **Unambiguous structure** — `{ }` braces define scope, not whitespace or heading levels. No guessing where a section ends.
|
|
8
|
+
- **Progressive disclosure** — AI agents can read a table of contents, then extract only the sections they need. No need to consume the whole file.
|
|
9
|
+
- **Unlimited nesting** — Nest scopes as deep as you like. Structure follows your content, not format limitations.
|
|
10
|
+
- **Content-presentation separation** — The AST is format-neutral. Render to HTML, slides, PDF, or anything else from the same source.
|
|
11
|
+
- **Human-readable as plain text** — No build step required to read an SDOC file. It looks good in any text editor.
|
|
12
|
+
|
|
13
|
+
## What's in the Box
|
|
14
|
+
|
|
15
|
+
**The format** — a formal specification (`lexica/specification.sdoc`) with EBNF grammar, plus a comprehensive authoring guide written as an AI agent skill document. Drop `lexica/sdoc-authoring.sdoc` into any AI agent's context and it can read and write SDOC immediately.
|
|
16
|
+
|
|
17
|
+
**A zero-dependency JavaScript parser** — `src/sdoc.js` parses SDOC into a format-neutral AST. No runtime dependencies, works anywhere Node runs. Parsing and rendering are cleanly separated — build your own renderers on top.
|
|
18
|
+
|
|
19
|
+
**Slide deck generation** — turn any SDOC file into an HTML slide deck with themes, layouts (center, two-column), speaker notes, mermaid diagrams, and PDF export via headless Chrome.
|
|
20
|
+
|
|
21
|
+
**A document site builder** — serve a folder of SDOC files as a browsable site with sidebar navigation, search, and split-pane comparison.
|
|
22
|
+
|
|
23
|
+
**A VS Code extension** — live preview, sticky scroll, code folding, document symbols, mermaid rendering, and commands for all the above.
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Build and install the VS Code extension
|
|
29
|
+
npm install
|
|
30
|
+
npm run package
|
|
31
|
+
code --install-extension dist/sdoc-*.vsix
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Open any `.sdoc` file and click the preview icon in the editor title bar, or run **SDOC: Open Preview to the Side** from the Command Palette.
|
|
35
|
+
|
|
36
|
+
### Build slides
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
node tools/build-slides.js deck.sdoc -o slides.html
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Each top-level scope becomes a slide. Set `type: slides` in `@meta`. See `lexica/slide-authoring.sdoc` for the full authoring guide.
|
|
43
|
+
|
|
44
|
+
### Browse documents
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python3 tools/serve_docs.py docs/
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or use the **SDOC: Browse Documents** command from the VS Code Command Palette.
|
|
51
|
+
|
|
52
|
+
## Format at a Glance
|
|
53
|
+
|
|
54
|
+
```sdoc
|
|
55
|
+
# Chapter One @chapter-1
|
|
56
|
+
{
|
|
57
|
+
This is body text with *emphasis*, **strong**, and `code`.
|
|
58
|
+
|
|
59
|
+
# Nested Section @details
|
|
60
|
+
{
|
|
61
|
+
Unlimited nesting. Each scope is independently addressable.
|
|
62
|
+
|
|
63
|
+
{[code lang=python]
|
|
64
|
+
def hello():
|
|
65
|
+
print("Hello from SDOC")
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# A List
|
|
70
|
+
{
|
|
71
|
+
{[.]
|
|
72
|
+
- First item
|
|
73
|
+
- Second item with **bold**
|
|
74
|
+
- Third item
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Learning the Format
|
|
81
|
+
|
|
82
|
+
- `docs/guide/intro.sdoc` — what SDOC is and why
|
|
83
|
+
- `docs/tutorials/first-steps.sdoc` — write your first document
|
|
84
|
+
- `docs/reference/syntax.sdoc` — full syntax reference
|
|
85
|
+
- `SDOC_GUIDE.md` — quick reference in Markdown (also used by AI tools)
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
|
|
89
|
+
This project uses **Git Flow**:
|
|
90
|
+
|
|
91
|
+
| Branch | Purpose |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `main` | Stable releases, tagged with version numbers |
|
|
94
|
+
| `develop` | Integration branch — features merge here |
|
|
95
|
+
| `release/vX.Y.Z` | Cut from `develop` when ready to release |
|
|
96
|
+
| `feat/*`, `fix/*` | Short-lived branches off `develop` |
|
|
97
|
+
|
|
98
|
+
**To contribute:**
|
|
99
|
+
|
|
100
|
+
1. Create a branch off `develop` (`feat/my-feature`, `fix/parser-bug`, etc.)
|
|
101
|
+
2. Make your changes, commit, push
|
|
102
|
+
3. Open a PR targeting `develop`
|
|
103
|
+
4. Get one approval from another contributor
|
|
104
|
+
5. Merge (squash or regular — your call)
|
|
105
|
+
|
|
106
|
+
Release branches merge to both `main` and `develop`. No direct pushes to `main` or `develop`.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
[MIT](LICENSE) — 2026 Irreversible Inc.
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@entropicwarrior/sdoc",
|
|
3
|
+
"displayName": "SDOC",
|
|
4
|
+
"description": "A plain-text documentation format with explicit brace scoping — deterministic parsing, AI-agent efficiency, and 10-50x token savings vs Markdown.",
|
|
5
|
+
"version": "0.1.3",
|
|
6
|
+
"publisher": "entropicwarrior",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/entropicwarrior/sdoc"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/entropicwarrior/sdoc",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/entropicwarrior/sdoc/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"sdoc",
|
|
18
|
+
"documentation",
|
|
19
|
+
"plain-text",
|
|
20
|
+
"slides",
|
|
21
|
+
"preview",
|
|
22
|
+
"ai-agent"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./index.js",
|
|
26
|
+
"./notion": "./src/notion-renderer.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"vscode": "^1.95.0"
|
|
30
|
+
},
|
|
31
|
+
"categories": [
|
|
32
|
+
"Other"
|
|
33
|
+
],
|
|
34
|
+
"activationEvents": [
|
|
35
|
+
"onLanguage:sdoc",
|
|
36
|
+
"onCommand:sdoc.preview",
|
|
37
|
+
"onCommand:sdoc.previewToSide",
|
|
38
|
+
"onCommand:sdoc.exportHtml",
|
|
39
|
+
"onCommand:sdoc.openInBrowser",
|
|
40
|
+
"onCommand:sdoc.browseDocs",
|
|
41
|
+
"onCommand:sdoc.newKnowledgeFile",
|
|
42
|
+
"onCommand:sdoc.generateAbout",
|
|
43
|
+
"onCommand:sdoc.previewFromExplorer"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"package": "npx vsce package --out dist/"
|
|
47
|
+
},
|
|
48
|
+
"main": "./src/extension.js",
|
|
49
|
+
"contributes": {
|
|
50
|
+
"languages": [
|
|
51
|
+
{
|
|
52
|
+
"id": "sdoc",
|
|
53
|
+
"aliases": [
|
|
54
|
+
"SDOC"
|
|
55
|
+
],
|
|
56
|
+
"extensions": [
|
|
57
|
+
".sdoc"
|
|
58
|
+
],
|
|
59
|
+
"configuration": "./language-configuration.json"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"grammars": [
|
|
63
|
+
{
|
|
64
|
+
"language": "sdoc",
|
|
65
|
+
"scopeName": "source.sdoc",
|
|
66
|
+
"path": "./syntaxes/sdoc.tmLanguage.json"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"commands": [
|
|
70
|
+
{
|
|
71
|
+
"command": "sdoc.preview",
|
|
72
|
+
"title": "SDOC: Open Preview"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"command": "sdoc.previewToSide",
|
|
76
|
+
"title": "SDOC: Open Preview to the Side",
|
|
77
|
+
"icon": "$(open-preview)"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"command": "sdoc.exportHtml",
|
|
81
|
+
"title": "SDOC: Export HTML",
|
|
82
|
+
"icon": "$(desktop-download)"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"command": "sdoc.openInBrowser",
|
|
86
|
+
"title": "SDOC: Open in Browser",
|
|
87
|
+
"icon": "$(link-external)"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"command": "sdoc.browseDocs",
|
|
91
|
+
"title": "SDOC: Browse Documents"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"command": "sdoc.newKnowledgeFile",
|
|
95
|
+
"title": "SDOC: New Knowledge File"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"command": "sdoc.generateAbout",
|
|
99
|
+
"title": "SDOC: Generate About"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"command": "sdoc.previewFromExplorer",
|
|
103
|
+
"title": "Open SDOC Preview",
|
|
104
|
+
"icon": "$(open-preview)"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"configurationDefaults": {
|
|
108
|
+
"[sdoc]": {
|
|
109
|
+
"editor.wordWrap": "on"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"languageModelTools": [
|
|
113
|
+
{
|
|
114
|
+
"name": "sdoc_reference",
|
|
115
|
+
"tags": [
|
|
116
|
+
"sdoc",
|
|
117
|
+
"documentation"
|
|
118
|
+
],
|
|
119
|
+
"toolReferenceName": "sdoc",
|
|
120
|
+
"displayName": "SDOC Reference",
|
|
121
|
+
"modelDescription": "Returns the SDOC format reference guide. Use this tool when you need to create, edit, or understand .sdoc files. SDOC is a plain text documentation format with explicit brace scoping, headings with #, inline formatting like Markdown, and features like braceless scopes, implicit root, lists, tables, code blocks, and meta scopes.",
|
|
122
|
+
"userDescription": "Get the SDOC format reference guide for creating and editing .sdoc files.",
|
|
123
|
+
"canBeReferencedInPrompt": true,
|
|
124
|
+
"icon": "$(book)",
|
|
125
|
+
"inputSchema": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"properties": {}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"menus": {
|
|
132
|
+
"editor/title": [
|
|
133
|
+
{
|
|
134
|
+
"command": "sdoc.previewToSide",
|
|
135
|
+
"when": "editorLangId == sdoc",
|
|
136
|
+
"group": "navigation"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"command": "sdoc.exportHtml",
|
|
140
|
+
"when": "activeWebviewPanelId == 'sdoc.preview'",
|
|
141
|
+
"group": "navigation"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"command": "sdoc.openInBrowser",
|
|
145
|
+
"when": "activeWebviewPanelId == 'sdoc.preview'",
|
|
146
|
+
"group": "navigation"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"explorer/context": [
|
|
150
|
+
{
|
|
151
|
+
"command": "sdoc.previewFromExplorer",
|
|
152
|
+
"when": "resourceExtname == .sdoc",
|
|
153
|
+
"group": "navigation"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"command": "sdoc.newKnowledgeFile",
|
|
157
|
+
"group": "navigation"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"devDependencies": {
|
|
163
|
+
"@vscode/vsce": "^3.7.1"
|
|
164
|
+
}
|
|
165
|
+
}
|