docmedown 0.1.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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +277 -0
  3. package/bin/docmedown.js +2 -0
  4. package/dist/cli.js +1053 -0
  5. package/dist/docmedown.cjs +356 -0
  6. package/dist/docmedown.iife.js +356 -0
  7. package/dist/docmedown.mjs +33543 -0
  8. package/dist/types/runtime/app.d.ts +9 -0
  9. package/dist/types/runtime/components/Builtins.d.ts +44 -0
  10. package/dist/types/runtime/components/Content.d.ts +2 -0
  11. package/dist/types/runtime/components/DmdRegistry.d.ts +17 -0
  12. package/dist/types/runtime/components/Layout.d.ts +2 -0
  13. package/dist/types/runtime/components/Navbar.d.ts +2 -0
  14. package/dist/types/runtime/components/Sidebar.d.ts +2 -0
  15. package/dist/types/runtime/components/TableOfContents.d.ts +8 -0
  16. package/dist/types/runtime/config.d.ts +14 -0
  17. package/dist/types/runtime/index.d.ts +6 -0
  18. package/dist/types/runtime/loader/auto-indexer.d.ts +3 -0
  19. package/dist/types/runtime/loader/local-loader.d.ts +11 -0
  20. package/dist/types/runtime/loader/remote-github.d.ts +10 -0
  21. package/dist/types/runtime/loader/remote-gitlab.d.ts +9 -0
  22. package/dist/types/runtime/markdown/callouts.d.ts +17 -0
  23. package/dist/types/runtime/markdown/highlighter.d.ts +19 -0
  24. package/dist/types/runtime/markdown/katex.d.ts +1 -0
  25. package/dist/types/runtime/markdown/mermaid.d.ts +1 -0
  26. package/dist/types/runtime/markdown/parser.d.ts +17 -0
  27. package/dist/types/runtime/markdown/renderer.d.ts +7 -0
  28. package/dist/types/runtime/provider/DocProvider.d.ts +38 -0
  29. package/dist/types/runtime/provider/ThemeProvider.d.ts +18 -0
  30. package/dist/types/runtime/router.d.ts +23 -0
  31. package/dist/types/runtime/search/SearchModal.d.ts +11 -0
  32. package/dist/types/runtime/search/search-index.d.ts +9 -0
  33. package/dist/types/runtime/types.d.ts +165 -0
  34. package/package.json +110 -0
  35. package/templates/.dmd/components.js +25 -0
  36. package/templates/README.md +68 -0
  37. package/templates/docs.json +25 -0
  38. package/templates/getting-started.md +64 -0
  39. package/templates/guides/custom-components.md +78 -0
  40. package/templates/index.html +19 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gabriel M. Silva
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,277 @@
1
+ # DocMeDown ⚡
2
+ ### *The simplest MarkDown documenter yet.*
3
+
4
+ [![npm version](https://img.shields.io/npm/v/docmedown.svg?style=flat-square&color=6366f1)](https://www.npmjs.com/package/docmedown)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg?style=flat-square)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg?style=flat-square)](https://www.typescriptlang.org/)
7
+ [![CI](https://github.com/gabrielmsilva00/docmedown/actions/workflows/ci.yml/badge.svg)](https://github.com/gabrielmsilva00/docmedown/actions/workflows/ci.yml)
8
+
9
+ **DocMeDown** is a zero-friction, ultra-lightweight documentation engine and CLI utility. Similar in visual elegance and features to **Docusaurus** and **VitePress**, but with **10x simpler setup** and zero build baggage.
10
+
11
+ Source code, issues, and releases live at [github.com/gabrielmsilva00/docmedown](https://github.com/gabrielmsilva00/docmedown).
12
+
13
+ Drop a single `index.html` file into any directory of `.md` files, and you have a blazing fast, glassmorphic documentation website.
14
+
15
+ ---
16
+
17
+ ## ✨ Features at a Glance
18
+
19
+ - 🚀 **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
+ - 🌐 **Dual Usage: CLI Tool & Web Script**:
21
+ - Run via single-line CLI: `npx docmedown ./docs`
22
+ - Or drop `<script src="docmedown.js"></script>` into an `index.html` on any static host.
23
+ - ⚡ **Dynamic Remote GitHub / GitLab Mode**: Document any GitHub or GitLab repository *live* without hosting markdown files statically! Changes pushed to your repo dynamically update the documentation website immediately.
24
+ - 📦 **100% Offline Single-File Bundler**: Generate a self-contained `index.html` with all markdown content and scripts inlined, ready to be double-clicked (`file:///`) offline anywhere without a web server.
25
+ - 🎨 **Glassmorphic Modern Design**: Dark & Light modes, customizable themes (**Indigo, Emerald, Sunset, Violet, Rose, Slate, Cyberpunk**), reading progress bar, breadcrumbs, and TOC scrollspy.
26
+ - 🔍 **Instant Fuzzy Search**: Keyboard-driven command palette (`⌘K` / `Ctrl+K`) with real-time in-browser indexing.
27
+ - ⚛️ **React Custom Components (.dmd)**: Support for custom React components inside `.dmd/` or built-in components (`<Tabs>`, `<CardGrid>`, `<Badge>`, `<Steps>`).
28
+ - 📊 **Mermaid Diagrams & KaTeX Math**: Render interactive architecture diagrams and LaTeX equations natively.
29
+ - 💡 **GitHub-Style Callouts**: Full support for `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, and `[!CAUTION]`.
30
+
31
+ ---
32
+
33
+ ## 🚀 10-Second Quickstart
34
+
35
+ ### Option 1: Using the CLI Tool
36
+
37
+ ```bash
38
+ # Scaffold a new documentation directory and start preview immediately
39
+ npx docmedown ./docs
40
+ ```
41
+
42
+ To configure branding, themes, or remote GitHub repository sources with an interactive terminal wizard:
43
+
44
+ ```bash
45
+ npx docmedown config
46
+ ```
47
+
48
+ ### Option 2: Pure Web Script (Zero CLI Required)
49
+
50
+ Create an `index.html` inside your docs folder:
51
+
52
+ ```html
53
+ <!DOCTYPE html>
54
+ <html lang="en">
55
+ <head>
56
+ <meta charset="UTF-8" />
57
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
58
+ <title>My Docs</title>
59
+ </head>
60
+ <body>
61
+ <div id="dmd-app"></div>
62
+ <script src="https://cdn.jsdelivr.net/npm/docmedown@latest/dist/docmedown.iife.js"></script>
63
+ </body>
64
+ </html>
65
+ ```
66
+
67
+ Place your `README.md` alongside `index.html`, and you're done!
68
+
69
+ ---
70
+
71
+ ## 🔌 Embedding & Lifecycle Integration
72
+
73
+ For a host application that controls when documentation mounts, opt out of automatic initialization before loading the script:
74
+
75
+ ```html
76
+ <script>
77
+ window.__DOCMEDOWN_NO_AUTO_INIT__ = true;
78
+ </script>
79
+ <script src="https://cdn.jsdelivr.net/npm/docmedown@latest/dist/docmedown.iife.js"></script>
80
+ ```
81
+
82
+ Then mount it into a specific element. `init` resolves to an instance with a `destroy()` method, so single-page applications can cleanly replace the reader when routes change.
83
+
84
+ ```html
85
+ <div id="project-docs"></div>
86
+ <script>
87
+ async function showDocs() {
88
+ const docs = await window.DocMeDown.init({
89
+ el: '#project-docs',
90
+ basePath: '/help',
91
+ config: {
92
+ name: 'Project help',
93
+ theme: { preset: 'emerald', defaultMode: 'auto' }
94
+ }
95
+ });
96
+
97
+ // Call docs.destroy() before removing #project-docs from the page.
98
+ }
99
+
100
+ showDocs();
101
+ </script>
102
+ ```
103
+
104
+ The mount element emits `docmedown:ready` with the instance in `event.detail`, and `docmedown:destroyed` when it is unmounted. As an HTML-only alternative, add `data-docmedown-auto-init="false"` to the DocMeDown `<script>` tag.
105
+
106
+ ---
107
+
108
+ ## 🌐 Dynamic Remote GitHub / GitLab Mode
109
+
110
+ Want to host your documentation on GitHub Pages or Vercel **without** committing your markdown files or setting up complex CI builds?
111
+
112
+ Simply create `docs.json`:
113
+
114
+ ```json title="docs.json"
115
+ {
116
+ "name": "Live Project Docs",
117
+ "source": {
118
+ "type": "github",
119
+ "repo": "facebook/react",
120
+ "branch": "main",
121
+ "docsDir": "docs"
122
+ },
123
+ "theme": {
124
+ "preset": "indigo",
125
+ "defaultMode": "auto"
126
+ }
127
+ }
128
+ ```
129
+
130
+ Host only the `index.html` and `docs.json` file. DocMeDown will dynamically discover and pull the markdown content directly from GitHub on demand!
131
+
132
+ ---
133
+
134
+ ## 📦 Single-File Offline Bundling
135
+
136
+ Every standard build produces both your serveable documentation files and a **100% self-contained offline `index.html` file**:
137
+
138
+ ```bash
139
+ npx docmedown build ./docs
140
+ ```
141
+
142
+ The serveable manifest and runtime remain in `./docs`. The offline artifact is written to `./docs/.dist/index.html`; dot-prefixed directories are excluded from document discovery. Open that file directly in a browser (`file:///.../.dist/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.
143
+
144
+ `docmedown serve ./docs` and `docmedown dev ./docs` also run this standard build at startup. While the server is running, Markdown and `docs.json` changes are debounced, then rebuild the serveable artifacts and `./docs/.dist/index.html` before the browser reloads.
145
+
146
+ To rebuild both outputs without starting a preview server, use watch mode:
147
+
148
+ ```bash
149
+ npx docmedown build ./docs --watch
150
+ ```
151
+
152
+ Within this repository, the equivalent command is `npm run build:docs:watch`.
153
+
154
+ ---
155
+
156
+ ## ⚛️ Custom React Components (.dmd)
157
+
158
+ Define global React components in a browser-loadable `.dmd/components.js` module. React is available as `window.React` in that module:
159
+
160
+ ```js title=".dmd/components.js"
161
+ const { createElement, useState } = window.React;
162
+
163
+ export function CounterButton() {
164
+ const [count, setCount] = useState(0);
165
+ return createElement(
166
+ 'button',
167
+ { onClick: () => setCount((value) => value + 1) },
168
+ `Clicked ${count} times`
169
+ );
170
+ }
171
+
172
+ export default {
173
+ CounterButton,
174
+ };
175
+ ```
176
+
177
+ You can now use `<CounterButton />` anywhere inside your Markdown documents!
178
+
179
+ The standard build embeds `.dmd/components.js` in `docs/.dist/index.html`, so the same custom components work in the distributable offline bundle.
180
+
181
+ ### Ready-to-Use Built-in Markdown Components
182
+
183
+ ```html
184
+ <!-- Interactive Tabs -->
185
+ <Tabs>
186
+ <Tab label="npm">npm install docmedown</Tab>
187
+ <Tab label="yarn">yarn add docmedown</Tab>
188
+ <Tab label="pnpm">pnpm add docmedown</Tab>
189
+ </Tabs>
190
+
191
+ <!-- Feature Cards -->
192
+ <CardGrid cols={2}>
193
+ <Card
194
+ title="Instant Setup"
195
+ description="Zero configuration required."
196
+ badge="Fast"
197
+ badgeType="success"
198
+ />
199
+ <Card
200
+ title="Glassmorphic Theme"
201
+ description="Sleek dark and light modes."
202
+ badge="New"
203
+ badgeType="new"
204
+ />
205
+ </CardGrid>
206
+
207
+ <!-- Step-by-Step Guide -->
208
+ <Steps>
209
+ <Step title="Install" step={1}>Install via npm or use standalone script.</Step>
210
+ <Step title="Write Markdown" step={2}>Add your .md guides and tutorials.</Step>
211
+ <Step title="Publish" step={3}>Deploy to any static web host or GitHub Pages.</Step>
212
+ </Steps>
213
+ ```
214
+
215
+ ---
216
+
217
+ ## ⚙️ Configuration Reference (`docs.json`)
218
+
219
+ ```json
220
+ {
221
+ "name": "My Documentation",
222
+ "tagline": "The simplest Markdown documenter yet",
223
+ "version": "1.0.0",
224
+ "rootDoc": "README.md",
225
+ "theme": {
226
+ "preset": "indigo",
227
+ "defaultMode": "auto"
228
+ },
229
+ "nav": [
230
+ { "label": "Overview", "href": "#/README" },
231
+ { "label": "Getting Started", "href": "#/getting-started" },
232
+ { "label": "Guides", "href": "#/guides/custom-components" }
233
+ ],
234
+ "socials": [
235
+ { "type": "github", "url": "https://github.com/my-org/my-repo" }
236
+ ],
237
+ "search": {
238
+ "enabled": true,
239
+ "placeholder": "Search docs..."
240
+ },
241
+ "footer": {
242
+ "copyright": "© 2026 My Organization. All rights reserved.",
243
+ "showBuiltWith": true
244
+ }
245
+ }
246
+ ```
247
+
248
+ ### Color Presets Available
249
+
250
+ | Preset | Accent Color | Vibe |
251
+ | :--- | :--- | :--- |
252
+ | `indigo` *(default)* | `#6366f1` | Clean, modern, developer-focused |
253
+ | `emerald` | `#10b981` | Fresh, high-tech, eco |
254
+ | `sunset` | `#f59e0b` | Warm amber and energy |
255
+ | `violet` | `#8b5cf6` | Vibrant, creative |
256
+ | `rose` | `#f43f5e` | Bold, stylish quartz |
257
+ | `slate` | `#64748b` | Minimalist monochrome |
258
+ | `cyberpunk` | `#00f0ff` | Glowing neon aesthetic |
259
+
260
+ ---
261
+
262
+ ## 🛠️ CLI Command Reference
263
+
264
+ | Command | Description |
265
+ | :--- | :--- |
266
+ | `docmedown [dir]` | Auto-initializes if empty, or starts local preview server |
267
+ | `docmedown init [dir]` | Scaffolds starter docs, `index.html`, `docs.json`, and `.dmd` folder |
268
+ | `docmedown serve [dir]` (or `dev`) | Starts local live-reloading dev server on `http://localhost:3000` |
269
+ | `docmedown build [dir]` | Builds serveable files and `./<dir>/.dist/index.html` for offline use |
270
+ | `docmedown build [dir] --no-single-file` | Builds serveable files only |
271
+ | `docmedown config [path]` | Launches interactive TUI configuration wizard |
272
+
273
+ ---
274
+
275
+ ## 📄 License
276
+
277
+ MIT © DocMeDown Contributors
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli.js');