@sullux/markdown-docs 1.0.3 → 1.0.5

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 CHANGED
@@ -1,104 +1,37 @@
1
+ <p align="center">
2
+ <img src="docs/logo.svg" alt="Markdown Docs" width="160" height="160" />
3
+ </p>
4
+
1
5
  # @sullux/markdown-docs
2
6
 
3
7
  A zero-dependency, local-first static documentation website generator compiling GitBook-style Markdown documentation folders into fast, responsive, searchable HTML websites.
4
8
 
5
- Built on `@sullux/markdown-compiler` and `@sullux/markdown-html`, `@sullux/markdown-docs` operates as both a standalone CLI application and a Node.js library.
9
+ 📖 **Official Documentation:** [https://sullux.com/projects/markdown/markdown-docs/](https://sullux.com/projects/markdown/markdown-docs/)
6
10
 
7
- ## Core Features
11
+ ## Overview
8
12
 
9
- * **GitBook `SUMMARY.md` Support:** Automatically parses `SUMMARY.md` navigation lists and `## Section` headers into sidebar navigation menus (with directory auto-discovery fallback if `SUMMARY.md` is omitted).
10
- * **Zero Dependencies:** Pure Vanilla JS implementation using Node.js built-ins.
11
- * **Declarative Site Configuration (`docs.yaml`):** Comprehensive YAML configuration file support for logos, themes, external links, favicons, and base URLs.
12
- * **Dual Light/Dark Branding:** Supports dual logos (`logo.light`, `logo.dark`) and dual color schemes with native OS system dark mode detection and client-side manual toggle persistence.
13
- * **Client-Side Search:** Auto-generates a lightweight JSON search index and embedded client-side search UI.
14
- * **Responsive 3-Column Layout:** Sticky header with top search bar, left navigation sidebar, center content stream, and right page outline (TOC) with responsive slide-in drawers for mobile.
15
- * **Rich Component Support:** Supports code syntax highlighting, callout boxes (`> [!NOTE]`, `{% hint %}`), GFM tables, and custom image dimensions.
16
- * **Static Asset Copying:** Automatically copies non-Markdown assets (images, SVGs, PDFs) directly to the output directory.
13
+ Built on `@sullux/markdown-compiler` and `@sullux/markdown-html`, `@sullux/markdown-docs` compiles directories of Markdown files into production-ready static documentation sites with zero third-party dependencies. It operates both as a standalone CLI utility and as a Node.js library.
17
14
 
18
- ## CLI Usage
15
+ It features automatic `SUMMARY.md` navigation hierarchy parsing, embedded client-side search, a responsive 3-column layout with mobile navigation drawers, native dual light/dark themes with system preference tracking and toggle persistence, static asset bundling, and declarative `docs.yaml` site configuration.
19
16
 
20
- ```bash
21
- # Generate site using default docs.yaml configuration in ./docs
22
- markdown-docs -i ./docs -o ./_site
17
+ ## Quick Start
23
18
 
24
- # Build with a custom base URL for CI/CD environments
25
- markdown-docs -i ./docs -o ./_site -b "/my-app-docs/"
26
- ```
19
+ ### Installation
27
20
 
28
- ### CLI Options
29
-
30
- | Flag | Long Flag | Description | Default |
31
- | :--- | :--- | :--- | :--- |
32
- | `-i` | `--input` | Path to input Markdown docs directory | Current working directory |
33
- | `-o` | `--output` | Path to output build directory | `<input>/_site` |
34
- | `-b` | `--base-url` | Base URL prefix for links and deployment | `""` |
35
- | `-t` | `--title` | Site title override (overrides `docs.yaml`) | `title` in `docs.yaml` |
36
- | `-c` | `--config` | Custom path to config file | `<input>/docs.yaml` |
37
- | `-h` | `--help` | Display CLI help menu | |
38
-
39
- ---
40
-
41
- ## Site Configuration (`docs.yaml`)
42
-
43
- You can configure your documentation site by placing a `docs.yaml` (or `docs.yml` / `docs.json`) file in your input documentation directory.
44
-
45
- ### Example `docs.yaml`
46
-
47
- ```yaml
48
- # Site Title (Optional: omit or leave empty for logo-only headers)
49
- title: "BucketDB"
50
-
51
- # Output directory (Optional: can also be passed via CLI)
52
- output: "_site"
53
-
54
- # Base URL prefix (Optional: useful for GitHub Pages or subdirectory hosting)
55
- baseUrl: "/docs"
56
-
57
- # Brand Logo (Supports single path/SVG, or dual light/dark images)
58
- logo:
59
- light: "assets/logo-light.svg"
60
- dark: "assets/logo-dark.svg"
61
-
62
- # Favicon Asset Path or URL
63
- favicon: "assets/favicon.ico"
64
-
65
- # External Header Navigation Links
66
- links:
67
- - title: "GitHub"
68
- url: "https://github.com/sullux/coms"
69
- - title: "API Spec"
70
- url: "https://api.example.com"
71
-
72
- # Theme Color Overrides
73
- theme:
74
- light:
75
- bg: "#ffffff"
76
- accent: "#2563eb"
77
- codeBg: "#f8fafc"
78
- codeText: "#0f172a"
79
- dark:
80
- bg: "#121316"
81
- accent: "#3b82f6"
82
- codeBg: "#0a0b0e"
83
- codeText: "#f3f4f6"
21
+ ```bash
22
+ yarn add @sullux/markdown-docs
23
+ # or install globally
24
+ yarn global add @sullux/markdown-docs
84
25
  ```
85
26
 
86
- ### Configuration Options Reference
87
-
88
- | Property | Type | Description | Default |
89
- | :--- | :--- | :--- | :--- |
90
- | `title` | `string` | Product or site name displayed in header & `<title>` tag. Leave empty (`""`) or omit when using a logo image containing the product name. | `""` |
91
- | `output` | `string` | Relative or absolute path to output build directory. | `<input>/_site` |
92
- | `baseUrl` | `string` | Base URL path prefix for hosting in subdirectories. | `""` |
93
- | `logo` | `string \| object` | Asset path/SVG string, or `{ light: "...", dark: "..." }` object for automatic theme switching. | `""` |
94
- | `favicon` | `string` | Asset path or URL to icon file. | Default book emoji (`📚`) |
95
- | `links` | `array` | Header external links array `[{ title: "...", url: "..." }]`. | `[]` |
96
- | `theme.light` | `object` | Light theme color overrides (`bg`, `accent`, `codeBg`, `codeText`). | Built-in light colors |
97
- | `theme.dark` | `object` | Dark theme color overrides (`bg`, `accent`, `codeBg`, `codeText`). | Built-in dark colors |
27
+ ### Usage (CLI)
98
28
 
99
- ---
29
+ ```bash
30
+ # Generate static HTML site from a docs directory
31
+ markdown-docs -i ./docs -o ./_site -t "Project Documentation"
32
+ ```
100
33
 
101
- ## Programmatic API Usage
34
+ ### Usage (Programmatic)
102
35
 
103
36
  ```javascript
104
37
  const { generateSite } = require('@sullux/markdown-docs')
@@ -112,8 +45,8 @@ const result = generateSite({
112
45
  console.log(`Generated ${result.pageCount} pages at ${result.output}`)
113
46
  ```
114
47
 
115
- ## Running Unit Tests
48
+ For complete guides, configuration options, and CLI references, see the [official documentation](https://sullux.com/projects/markdown/markdown-docs/).
116
49
 
117
- ```bash
118
- yarn test
119
- ```
50
+ ## Contributing & License
51
+
52
+ Please see the [Monorepo README](../../README.md) for contribution guidelines, testing instructions, and license details.
package/lib/config.js CHANGED
@@ -52,7 +52,10 @@ const normalizeConfig = (opts = {}) => {
52
52
  const input = path.resolve(opts.input || process.cwd())
53
53
  const fileConfig = loadFileConfig(input, opts.config)
54
54
 
55
- const output = path.resolve(opts.output || fileConfig.output || path.join(input, '_site'))
55
+ const rawOutput = opts.output || fileConfig.output
56
+ const output = rawOutput
57
+ ? (path.isAbsolute(rawOutput) ? rawOutput : (opts.output ? path.resolve(rawOutput) : path.resolve(input, rawOutput)))
58
+ : path.join(input, '_site')
56
59
  const title = opts.title !== undefined ? opts.title : (fileConfig.title !== undefined ? fileConfig.title : '')
57
60
  const baseUrl = opts.baseUrl !== undefined ? opts.baseUrl : (fileConfig.baseUrl !== undefined ? fileConfig.baseUrl : '')
58
61
  const logo = fileConfig.logo || opts.logo || ''
package/lib/layout.js CHANGED
@@ -101,7 +101,15 @@ const renderPageLayout = ({ title, siteTitle, navTree, toc, contentHtml, current
101
101
  <div class="app-container">
102
102
  <aside id="sidebar-drawer" class="app-sidebar"><div class="drawer-header"><span class="drawer-title">Navigation</span><button class="drawer-close" onclick="closeAllDrawers()">${SVGS.close}</button></div><nav class="app-nav">${sidebarNav}</nav></aside>
103
103
  <main class="app-main"><article class="app-article">${contentHtml}</article></main>
104
- <aside id="toc-drawer" class="app-toc"><div class="toc-container">${renderTocList(toc)}</div></aside>
104
+ <aside id="toc-drawer" class="app-toc">
105
+ <div class="drawer-header"><span class="drawer-title">Page Outline</span><button class="drawer-close" onclick="closeAllDrawers()">${SVGS.close}</button></div>
106
+ <div class="toc-container">${renderTocList(toc)}</div>
107
+ <div class="theme-picker">
108
+ <button class="theme-opt" data-mode="light" onclick="setThemeMode('light')" title="Light">${SVGS.sun}</button>
109
+ <button class="theme-opt" data-mode="system" onclick="setThemeMode('system')" title="System">${SVGS.system}</button>
110
+ <button class="theme-opt" data-mode="dark" onclick="setThemeMode('dark')" title="Dark">${SVGS.moon}</button>
111
+ </div>
112
+ </aside>
105
113
  </div>
106
114
  <div id="drawer-backdrop" class="drawer-backdrop" onclick="closeAllDrawers()"></div>
107
115
  <script>${getSearchScript()}</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sullux/markdown-docs",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A zero-dependency, local-first static documentation site generator compiling GitBook-style Markdown docs.",
5
5
  "main": "./index.js",
6
6
  "bin": {