@sullux/markdown-docs 1.0.4 → 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 +24 -91
- package/lib/config.js +4 -1
- package/package.json +1 -1
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
|
-
|
|
9
|
+
📖 **Official Documentation:** [https://sullux.com/projects/markdown/markdown-docs/](https://sullux.com/projects/markdown/markdown-docs/)
|
|
6
10
|
|
|
7
|
-
##
|
|
11
|
+
## Overview
|
|
8
12
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
21
|
-
# Generate site using default docs.yaml configuration in ./docs
|
|
22
|
-
markdown-docs -i ./docs -o ./_site
|
|
17
|
+
## Quick Start
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
markdown-docs -i ./docs -o ./_site -b "/my-app-docs/"
|
|
26
|
-
```
|
|
19
|
+
### Installation
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
48
|
+
For complete guides, configuration options, and CLI references, see the [official documentation](https://sullux.com/projects/markdown/markdown-docs/).
|
|
116
49
|
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
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/package.json
CHANGED