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
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Welcome to DocMeDown
3
+ description: The simplest MarkDown documenter yet.
4
+ icon: 🚀
5
+ order: 1
6
+ tags: [getting-started, overview, docs]
7
+ ---
8
+
9
+ # Welcome to DocMeDown ⚡
10
+
11
+ **DocMeDown** is the simplest Markdown documentation system yet. Drop an `index.html` file into any folder of Markdown files, and you have a fully-featured, blazing fast documentation website.
12
+
13
+ > [!TIP]
14
+ > **Zero Configuration Required**: DocMeDown automatically indexes all your `.md` files and subfolders into categories, builds navigation, and enables instant search out of the box!
15
+
16
+ ---
17
+
18
+ ## Key Features
19
+
20
+ - **🚀 Zero Build Friction**: Host statically, view locally offline (`file:///`), or document remote GitHub/GitLab repositories dynamically.
21
+ - **🎨 Glassmorphic Themes**: Sleek Dark & Light modes with multiple vibrant color presets (Indigo, Emerald, Sunset, Violet, Rose, Slate, Cyberpunk).
22
+ - **⚡ Fast Search**: In-browser fuzzy search with `⌘K` command palette.
23
+ - **⚛️ React Components**: Support for custom React components via `.dmd/` global registry or ready-to-use builtins.
24
+ - **📊 Diagrams & Math**: Native support for **Mermaid.js** diagrams and **KaTeX** math formulas.
25
+
26
+ ---
27
+
28
+ ## Architecture Flow
29
+
30
+ ```mermaid
31
+ graph LR
32
+ A[Markdown Files] --> B[DocMeDown Parser]
33
+ B --> C[React SPA Runtime]
34
+ C --> D[Live Documentation Site]
35
+ E[docs.json] --> C
36
+ F[.dmd Components] --> C
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Interactive Features Demo
42
+
43
+ ### 1. GitHub-style Callouts
44
+
45
+ > [!NOTE]
46
+ > This is a standard informative note callout.
47
+
48
+ > [!IMPORTANT]
49
+ > Important guidelines or critical notices appear with highlighted violet accents.
50
+
51
+ > [!WARNING]
52
+ > Warnings help developers avoid common pitfalls and mistakes.
53
+
54
+ ---
55
+
56
+ ### 2. Math Formulas
57
+
58
+ You can write inline math like $E = mc^2$ or block LaTeX math equations:
59
+
60
+ $$
61
+ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
62
+ $$
63
+
64
+ ---
65
+
66
+ ## Next Steps
67
+
68
+ Check out the [Quickstart Guide](./getting-started.md) to learn how to add your own pages and customize your site.
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "My Project Docs",
3
+ "tagline": "The simplest Markdown documentation yet",
4
+ "description": "Fast, modern documentation created with DocMeDown",
5
+ "version": "1.0.0",
6
+ "rootDoc": "README.md",
7
+ "theme": {
8
+ "preset": "indigo",
9
+ "defaultMode": "auto"
10
+ },
11
+ "nav": [
12
+ { "label": "Overview", "href": "#/README" },
13
+ { "label": "Quickstart", "href": "#/getting-started" },
14
+ { "label": "Guides", "href": "#/guides/custom-components" }
15
+ ],
16
+ "autoIndex": {
17
+ "enabled": true,
18
+ "sort": "natural",
19
+ "defaultCollapsed": false
20
+ },
21
+ "search": {
22
+ "enabled": true,
23
+ "placeholder": "Search documentation..."
24
+ }
25
+ }
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Getting Started
3
+ description: Quick installation and configuration guide for DocMeDown.
4
+ order: 2
5
+ tags: [setup, cli, quickstart]
6
+ ---
7
+
8
+ # Getting Started with DocMeDown
9
+
10
+ Learn how to initialize, configure, and serve your documentation in less than 30 seconds.
11
+
12
+ ---
13
+
14
+ ## 1. Quick Start via CLI
15
+
16
+ You can initialize a brand new documentation site with a single command:
17
+
18
+ ```bash
19
+ npx docmedown ./docs
20
+ ```
21
+
22
+ This scaffolds your documentation directory, creates starter Markdown guides, and starts a live preview server!
23
+
24
+ ---
25
+
26
+ ## 2. Interactive Configuration TUI
27
+
28
+ Need to customize your site title, theme palette, or configure a remote GitHub repository? Launch the interactive TUI configuration wizard:
29
+
30
+ ```bash
31
+ npx docmedown config
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 3. Remote GitHub Repository Mode
37
+
38
+ You can document any public (or private) GitHub repository dynamically without hosting any markdown files! Simply configure `docs.json`:
39
+
40
+ ```json title="docs.json"
41
+ {
42
+ "name": "Dynamic GitHub Docs",
43
+ "source": {
44
+ "type": "github",
45
+ "repo": "facebook/react",
46
+ "branch": "main",
47
+ "docsDir": "docs"
48
+ }
49
+ }
50
+ ```
51
+
52
+ Every push to your GitHub repo is immediately reflected on your documentation website live without rebuilds!
53
+
54
+ ---
55
+
56
+ ## 4. Single-File Offline Bundling
57
+
58
+ To generate a 100% self-contained single-file HTML documentation bundle that works offline via `file:///`:
59
+
60
+ ```bash
61
+ npx docmedown build ./docs
62
+ ```
63
+
64
+ The standalone artifact is written to `./docs/.dist/index.html`. You can send it by email, save it to USB drives, or distribute it inside air-gapped systems.
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: Custom React Components
3
+ description: Learn how to use .dmd components and interactive widgets inside your Markdown.
4
+ order: 1
5
+ tags: [components, react, dmd]
6
+ ---
7
+
8
+ # Custom React Components (.dmd)
9
+
10
+ DocMeDown supports embedding custom React components directly into your documentation.
11
+
12
+ ---
13
+
14
+ ## 1. Defining Global Components
15
+
16
+ Place a browser-loadable module at `.dmd/components.js`. DocMeDown exposes React as `window.React` inside that module:
17
+
18
+ ```js title=".dmd/components.js"
19
+ const { createElement, useState } = window.React;
20
+
21
+ export function InteractiveButton({ label = 'Click Me' }) {
22
+ const [count, setCount] = useState(0);
23
+ return createElement(
24
+ 'button',
25
+ { onClick: () => setCount((value) => value + 1) },
26
+ `${label}: ${count}`
27
+ );
28
+ }
29
+
30
+ export default {
31
+ InteractiveButton,
32
+ };
33
+ ```
34
+
35
+ ---
36
+
37
+ ## 2. Using Custom and Built-in Components
38
+
39
+ DocMeDown comes with built-in interactive components ready to use:
40
+
41
+ ```html
42
+ <InteractiveButton label="Count clicks" />
43
+ ```
44
+
45
+ ### Tabbed Code Snippets
46
+
47
+ ```html
48
+ <Tabs>
49
+ <Tab label="npm">
50
+ npm install docmedown
51
+ </Tab>
52
+ <Tab label="yarn">
53
+ yarn add docmedown
54
+ </Tab>
55
+ <Tab label="pnpm">
56
+ pnpm add docmedown
57
+ </Tab>
58
+ </Tabs>
59
+ ```
60
+
61
+ ### Feature Card Grid
62
+
63
+ ```html
64
+ <CardGrid cols={2}>
65
+ <Card
66
+ title="Zero Build Friction"
67
+ description="Drop index.html and start browsing immediately."
68
+ badge="Fast"
69
+ badgeType="success"
70
+ />
71
+ <Card
72
+ title="Remote GitHub Repos"
73
+ description="Document remote git repositories live."
74
+ badge="Live"
75
+ badgeType="new"
76
+ />
77
+ </CardGrid>
78
+ ```
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>DocMeDown Documentation</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
10
+ </head>
11
+ <body>
12
+ <div id="dmd-app"></div>
13
+
14
+ <!-- Pre-compiled docs data (enables 100% offline file:/// double-click viewing without web server) -->
15
+ <script src="./_docs.js"></script>
16
+ <!-- DocMeDown Runtime Script -->
17
+ <script src="./docmedown.iife.js"></script>
18
+ </body>
19
+ </html>