docmedown 0.9.6 → 0.9.7-c
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 +36 -12
- package/dist/cli.js +484 -187
- package/dist/dmd-locales-Qvd9N3_X.mjs +25 -0
- package/dist/dmd-locales-y1gPUs3s.js +211 -0
- package/dist/docmedown.cjs +363 -73
- package/dist/docmedown.iife.js +854 -354
- package/dist/docmedown.mjs +10630 -10112
- package/dist/docmedown.web.js +570 -70
- package/dist/embedded-dmd-locales.js +212 -0
- package/dist/types/runtime/config-schema.d.ts +109 -1
- package/dist/types/runtime/embedded-dmd-locales.d.ts +5 -0
- package/dist/types/runtime/embedded-dmd.d.ts +20 -0
- package/dist/types/runtime/i18n.d.ts +42 -0
- package/dist/types/runtime/markdown/parser.d.ts +2 -2
- package/dist/types/runtime/router.d.ts +3 -0
- package/dist/types/runtime/search/search-index.d.ts +1 -0
- package/dist/types/runtime/types.d.ts +2 -0
- package/dist/types/ui/doc-context.svelte.d.ts +61 -0
- package/dist/types/ui/registry.d.ts +3 -2
- package/package.json +5 -4
- package/schemas/docs.schema.json +38 -0
- package/templates/docs.json +12 -0
package/README.md
CHANGED
|
@@ -16,6 +16,30 @@ Drop a single `index.html` file into any directory of `.md` files, and you have
|
|
|
16
16
|
|
|
17
17
|
## ✨ Features at a Glance
|
|
18
18
|
|
|
19
|
+
### Release deployment
|
|
20
|
+
|
|
21
|
+
Maintainers run `npm run deploy` from `main`. The command validates the release,
|
|
22
|
+
commits tracked changes, pushes the release, publishes npm, and explicitly requests
|
|
23
|
+
the GitHub Pages workflow (`pages.yml`) on `main`, even when the version is already
|
|
24
|
+
fully published. GitHub CLI (`gh`) must be installed and authenticated with permission
|
|
25
|
+
to run Actions (`gh auth login`); npm authentication is also required. Workflow errors
|
|
26
|
+
abort the command rather than silently skipping Pages. Dispatch acceptance does not
|
|
27
|
+
mean the asynchronous Pages build has finished; inspect `gh run list --workflow pages.yml`.
|
|
28
|
+
Ordinary pushes to `main` still trigger Pages, so a release can also produce a push run;
|
|
29
|
+
the workflow's existing concurrency group serializes/cancels superseded runs.
|
|
30
|
+
`npm run deploy:dry-run` validates the release without dispatching Pages or publishing.
|
|
31
|
+
|
|
32
|
+
### Native multilingual projects
|
|
33
|
+
|
|
34
|
+
DocMeDown groups translations by filename (`guide.pt-br.md`), not language
|
|
35
|
+
directories. Project creation offers English, Brazilian Portuguese, Spanish,
|
|
36
|
+
French, German and Simplified Chinese, plus manually named language tags.
|
|
37
|
+
Choose the original language separately; missing document translations can fall
|
|
38
|
+
back to that original. The built-in `DMD` navigation and developer guides ship in
|
|
39
|
+
all six languages and use English when a custom language has no translation.
|
|
40
|
+
See [Internationalization](docs/guides/internationalization.md) for configuration,
|
|
41
|
+
export behavior and the current translation-coverage limitations.
|
|
42
|
+
|
|
19
43
|
- 🚀 **Zero-Config Auto-Discovery**: Automatically parses and indexes all `.md` files & subfolders into categories, builds navigation sidebars, and powers instant search out of the box.
|
|
20
44
|
- 📁 **Unified Root & `./docs/` Discovery**: Automatically detects markdown files at your project root (`README.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `ROADMAP.md`, etc.) and links both root and `./docs/` together by default without creating an artificial `./docs/` subdivision.
|
|
21
45
|
- 🌐 **Dual Usage: CLI Tool & Web Script**:
|
|
@@ -173,11 +197,11 @@ Every standard build produces both your serveable documentation files and a **10
|
|
|
173
197
|
npx docmedown build ./docs
|
|
174
198
|
```
|
|
175
199
|
|
|
176
|
-
The serveable
|
|
200
|
+
The serveable site and runtime live in `./docs/.dmd/` (prerendered pages, `sitemap.xml`, `robots.txt`, per-page SEO head tags included). The `docs/index.html` symlink targets that serveable entrypoint (`.dmd/index.html`) — the ONLY distributable at the docs root — so crawlers and static hosts see the full site; dot-prefixed directories are excluded from document discovery. The offline artifact is written separately to `./docs/.dmd/.singlefile/index.html`. The artifact stores compact JSON and the production runtime in a gzip-compressed, base64-encoded envelope with a minified self-extractor. Open that file directly in a browser (`file:///.../index.html`) on air-gapped machines, send it via email, or distribute it with offline desktop applications. Use `--no-single-file` to skip the offline artifact, or `--out-dir <path>` to place it elsewhere.
|
|
177
201
|
|
|
178
|
-
Serveable DocMeDown sites also include a **Download** action in the navbar. It reads the already-loaded documentation corpus and current runtime, compresses them locally with the browser's native gzip stream, and downloads the same self-contained format without requesting `.
|
|
202
|
+
Serveable DocMeDown sites also include a **Download** action in the navbar. It reads the already-loaded documentation corpus and current runtime, compresses them locally with the browser's native gzip stream, and downloads the same self-contained format without requesting `.dmd/.singlefile/index.html`. In a downloaded or CLI-built offline copy, the control is greyed out as **Offline copy** because the page is already portable.
|
|
179
203
|
|
|
180
|
-
`docmedown serve ./docs` and `docmedown dev ./docs` also run this standard build at startup. While the server is running, Markdown and
|
|
204
|
+
`docmedown serve ./docs` and `docmedown dev ./docs` also run this standard build at startup. While the server is running, Markdown and `.dmd/.config/docs.json` changes are debounced, then rebuild the serveable artifacts and `./docs/.dmd/.singlefile/index.html` before the browser reloads.
|
|
181
205
|
|
|
182
206
|
To rebuild both outputs without starting a preview server, use watch mode:
|
|
183
207
|
|
|
@@ -191,25 +215,25 @@ Within this repository, the equivalent command is `npm run build:docs:watch`.
|
|
|
191
215
|
|
|
192
216
|
## 🚢 GitHub Pages Hosting
|
|
193
217
|
|
|
194
|
-
The repository includes `.github/workflows/pages.yml`, which builds the production runtime and generated documentation assets before publishing `./docs/` through GitHub Pages. This is required because `_docs.js`, `_manifest.json`, and `docmedown.web.js` are generated files and intentionally ignored by Git.
|
|
218
|
+
The repository includes `.github/workflows/pages.yml`, which builds the production runtime and generated documentation assets before publishing `./docs/.dmd/` through GitHub Pages. This is required because `_docs.js`, `_manifest.json`, and `docmedown.web.js` are generated files and intentionally ignored by Git.
|
|
195
219
|
|
|
196
220
|
To enable it for a repository fork or project site:
|
|
197
221
|
|
|
198
222
|
1. Push the workflow to the `main` branch.
|
|
199
223
|
2. In **Settings → Pages**, set the source to **GitHub Actions**.
|
|
200
|
-
3. Push documentation or runtime changes; the workflow runs `npm ci`, `npm run build`, and `npm run build:docs`, then uploads the
|
|
224
|
+
3. Push documentation or runtime changes; the workflow runs `npm ci`, `npm run build`, and `npm run build:docs`, then uploads the hidden `docs/.dmd/` workspace (the `docs/index.html` symlink targets that same serveable entrypoint, so local `/docs/` serving matches Pages).
|
|
201
225
|
|
|
202
226
|
The generated entrypoint uses same-directory relative URLs (`./_docs.js` and `./docmedown.web.js`), so it works at both a custom domain and a project URL such as `/repository-name/`. The Pages workflow verifies those generated files before upload and includes `.nojekyll` for direct static-file compatibility. Hash routing keeps document navigation client-side without requiring server rewrites.
|
|
203
227
|
|
|
204
228
|
---
|
|
205
229
|
|
|
206
|
-
## 🧩 Custom Components (
|
|
230
|
+
## 🧩 Custom Components (`.dmd/.components/`)
|
|
207
231
|
|
|
208
232
|
DocMeDown provides a **Universal Component Compatibility Layer**. You can author custom widgets in **native Svelte 5**, **React with TypeScript (TSX)**, or standard **Web Elements (Lit)** with zero build setup:
|
|
209
233
|
|
|
210
|
-
### 1. Svelte 5 Component (`.dmd/CounterWidget.svelte`)
|
|
234
|
+
### 1. Svelte 5 Component (`.dmd/.components/CounterWidget.svelte`)
|
|
211
235
|
|
|
212
|
-
```svelte title=".dmd/CounterWidget.svelte"
|
|
236
|
+
```svelte title=".dmd/.components/CounterWidget.svelte"
|
|
213
237
|
<script>
|
|
214
238
|
let { title = "Interactive Counter" } = $props();
|
|
215
239
|
let count = $state(0);
|
|
@@ -221,9 +245,9 @@ DocMeDown provides a **Universal Component Compatibility Layer**. You can author
|
|
|
221
245
|
</div>
|
|
222
246
|
```
|
|
223
247
|
|
|
224
|
-
### 2. React TSX Component (`.dmd/ReactMetricCard.tsx`)
|
|
248
|
+
### 2. React TSX Component (`.dmd/.components/ReactMetricCard.tsx`)
|
|
225
249
|
|
|
226
|
-
```tsx title=".dmd/ReactMetricCard.tsx"
|
|
250
|
+
```tsx title=".dmd/.components/ReactMetricCard.tsx"
|
|
227
251
|
import React, { useState } from "react";
|
|
228
252
|
|
|
229
253
|
export default function ReactMetricCard({ label = "Query Rate", initial = 100 }) {
|
|
@@ -241,8 +265,8 @@ Use `<CounterWidget />` or `<ReactMetricCard />` directly inside any Markdown do
|
|
|
241
265
|
|
|
242
266
|
- **Build-Time AOT Compilation**: Standard React TSX components are compiled Ahead-of-Time into native Svelte 5 custom elements during `docmedown build`, eliminating React runtime overhead.
|
|
243
267
|
- **Runtime Bridge Fallback**: Complex React components mount cleanly via `ReactBridge` (`createRoot`), preserving hook fidelity.
|
|
244
|
-
- **Offline Parity**: All `.dmd/` components are pre-compiled and embedded in `./docs/.
|
|
245
|
-
- **Legacy Compatibility**:
|
|
268
|
+
- **Offline Parity**: All `.dmd/.components/` components are pre-compiled and embedded in `./docs/.dmd/.singlefile/index.html` for 100% self-contained offline functionality (the root `docs/index.html` symlink instead serves the SEO site).
|
|
269
|
+
- **Legacy Compatibility**: Bare `.dmd/` components and standard `.dmd/components.js` custom element modules remain fully supported as a deprecated fallback.
|
|
246
270
|
|
|
247
271
|
### Ready-to-Use Built-in Markdown Components
|
|
248
272
|
|