A lightweight, Docusaurus-like static site generator for creating beautiful documentation sites that can be hosted on GitHub Pages or GitLab Pages.
- Dark Mode: Automatic theme detection with manual toggle, smooth transitions, and localStorage persistence
- Responsive Design: Mobile-first design that works beautifully on all devices
- Mobile Sidebar Toggle: Hamburger menu with smooth slide-in animation
- Table of Contents: Auto-generated TOC with scroll spy for easy navigation
- Markdown-based: Write documentation in simple Markdown with frontmatter support
- Enhanced Code Blocks: Syntax highlighting with 190+ languages, code block titles, line highlighting, and toggleable line numbers
- Tabs Component: Show code examples in multiple languages/frameworks with interactive tabs
- Copy Code Button: One-click copy with visual feedback on all code blocks
- Image Support: Automatic image copying with validation and broken image detection
- Admonitions: Note, warning, tip, danger, and info callouts
- Fuzzy Search: Powered by Fuse.js with typo tolerance and configurable sensitivity
- Full-text Search: Search across titles, descriptions, and content with smart ranking
- Keyboard Shortcuts:
Ctrl/Cmd + Kto search, arrow keys to navigate - Recent Searches: Remembers your recent searches with localStorage
- Breadcrumb Navigation: Automatic breadcrumbs showing current location
- Auto-Generated Sidebar: Sidebar built from folder structure automatically
- Modular Architecture: Clean separation of concerns with focused modules
- Internal Link Validation: Automatic detection of broken links during build
- Git Metadata: Last updated timestamps auto-generated from Git history
- Hot Reload: Development server with automatic rebuilding
- Comprehensive Test Suite: 141 unit and integration tests with 100% pass rate
- Static Site Generation: Fast, optimized static HTML pages
- Git-friendly: Version control everything with GitHub tags for versioning
- Easy Deployment: Deploy to GitHub/GitLab Pages with ease
- Docker Ready: Containerized deployment support
- Node.js: >= 22.0.0 (LTS recommended)
- npm: >= 10.0.0
If using NVM, you can install and use the correct version:
nvm install 22
nvm use# Install dependencies
npm install
# Run tests
npm test
# Start development server
npm run dev
# Build for production
npm run build
# Serve built site
npm run servedoc-system/
βββ docs/ # Your markdown documentation files
β βββ intro.md
β βββ installation.md
β βββ guides/
β βββ configuration.md
β βββ deployment.md
βββ theme/ # Site styling and scripts
β βββ styles.css
β βββ search.js # Fuzzy search with Fuse.js
β βββ dark-mode.js
β βββ toc.js
β βββ copy-code.js
β βββ line-numbers.js
β βββ tabs.js
βββ scripts/ # Build and development scripts
β βββ build.js # Main build orchestrator
β βββ dev.js # Development server with hot reload
β βββ serve.js # Production server
β βββ lib/ # Modular build components
β βββ git-metadata.js # Git date/author extraction
β βββ link-validator.js # Internal link checking
β βββ image-processor.js # Image extraction/copying
β βββ markdown-processor.js # Marked config, extensions
β βββ navigation-builder.js # Sidebar, breadcrumbs, pagination
β βββ page-generator.js # HTML template generation
βββ tests/ # Test suite
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
βββ config.json # Site configuration
βββ package.json
Edit config.json to customize your site:
{
"title": "Documentation Site",
"description": "A modern documentation system",
"baseUrl": "/",
"docsDir": "docs",
"outputDir": "build",
"search": {
"maxResults": 10,
"fuzzyThreshold": 0.3,
"minMatchLength": 2
},
"navbar": {
"title": "Docs",
"links": [
{ "label": "Documentation", "to": "/docs/intro" },
{ "label": "GitHub", "href": "https://github.com/your-repo" }
]
},
"footer": {
"copyright": "Built with Doc System"
}
}| Option | Default | Description |
|---|---|---|
maxResults |
10 | Maximum number of search results to display |
fuzzyThreshold |
0.3 | Match sensitivity (0 = exact only, 1 = match anything) |
minMatchLength |
2 | Minimum characters before search activates |
Note: The sidebar is automatically generated from your folder structure in the docs/ directory:
- Root-level markdown files appear under "Getting Started"
- Subdirectories become separate categories (e.g.,
docs/guides/β "Guides" category) - Files are listed alphabetically within each category
- Titles come from the
title:field in each file's frontmatter
- Add Markdown files to the
docs/folder - Include frontmatter in each file:
---
title: Page Title
description: Page description
---
# Page Title
Your content here...- The sidebar updates automatically based on folder structure
This project includes automated CI/CD workflows:
Setup Steps:
- Go to your repository Settings β Pages
- Under "Build and deployment", select Source:
GitHub Actions - Push to
masterbranch - deployment happens automatically!
What happens:
- β Tests run on every push and PR
- β Build verification on commits
- β Automatic deployment to GitHub Pages on master
- β Build reports and statistics
The included workflows (.github/workflows/):
ci.yml- Runs tests, builds, security auditsdeploy.yml- Deploys to GitHub Pagessmart-tag.yml- Automatic version tagging
Create .gitlab-ci.yml:
image: node:22
pages:
script:
- npm install
- npm run build
- mv build public
artifacts:
paths:
- public
only:
- main# Development mode with hot reload
npm run dev
# Build static site
npm run build
# Preview production build
npm run serveThe development server will:
- Build your site
- Start a local server at http://localhost:3000
- Watch for changes and rebuild automatically
Edit theme/styles.css to customize the appearance. CSS variables are defined at the top:
:root {
--primary-color: #2563eb;
--text-color: #1f2937;
--bg-color: #ffffff;
/* ... */
}The search is powered by Fuse.js for fuzzy matching with typo tolerance.
Features:
- Fuzzy matching (typo tolerance)
- Instant search as you type
- Keyboard shortcuts:
Ctrl/Cmd + Kto focus,ββto navigate,Enterto open - Results ranked by relevance (title > description > content > slug)
- Highlighted search terms in results
- Configurable result limit and sensitivity
Customization:
Edit search settings in config.json:
{
"search": {
"maxResults": 15,
"fuzzyThreshold": 0.4,
"minMatchLength": 3
}
}Code blocks use Highlight.js with the GitHub Dark theme by default.
Change the theme:
Edit scripts/build.js and change the theme file:
// Available: github, github-dark, monokai, atom-one-dark, vs2015, etc.
const highlightCssSource = path.join(
rootDir,
'node_modules',
'highlight.js',
'styles',
'github-dark.css' // Change this
);Browse all themes: Highlight.js Demo
The build system is organized into focused modules for maintainability:
| Module | Purpose |
|---|---|
build.js |
Main orchestrator, file discovery, asset copying |
markdown-processor.js |
Marked configuration, admonitions, tabs, code blocks |
git-metadata.js |
Extract creation/update dates from git history |
link-validator.js |
Find and validate internal markdown links |
image-processor.js |
Extract image references, validate, copy to output |
navigation-builder.js |
Generate sidebar, breadcrumbs, pagination |
page-generator.js |
Generate complete HTML pages from templates |
MIT
Contributions are welcome! Please feel free to submit a Pull Request.