A modern Git-based Markdown wiki system with auto-sync, syntax highlighting, and Feishu-style UI.
🔗 Live Demo: https://powerwiki.ga666666.cn
English • 中文 • 日本語 • 한국어 • Español • Français • Deutsch • Русский
Screenshots from the live demo. The demo content is in Chinese; your wiki content comes from your own Git repository.
Browse nested folders on the left, read Markdown in the center, and jump between headings with the automatic table of contents on the right.
Code blocks, article metadata, and heading navigation share one reading view. Copy the document, switch to its raw Markdown, or share the article from the toolbar.
Render sequence diagrams directly inside your articles to explain interactions between users, browsers, and services.
Use the theme toggle to read the same documentation with a dark background.
HTML files sit in the same repository, appear in the sidebar and use the same reading view as Markdown: table of contents, copy, raw view, share link and view count. Only the <body> is rendered, and <title> plus <meta name="description"> become the article metadata.
Complete HTML pages — dashboards, landing pages, WebGL scenes — declare a sandbox meta tag and open in place as an immersive canvas. The sidebar stays on desktop, Esc or the exit button returns to the normal view, and the page inside the iframe keeps its state.
PowerWiki was born from deep reflection on "knowledge management" and "technical writing". We believe in:
No over-engineering, no complex wheels. Markdown + Git is the simplest knowledge management solution proven over a decade. No database, back to file systems, keeping knowledge pure.
Tailor-made for developers. Syntax highlighting, local image support, Git workflow — every feature comes from real development scenarios.
Zero learning cost to get started. Clone and use, push and update. No complex configuration, no dedicated CMS required.
Your data always belongs to you. Plain text storage, version control built-in, migrate to any platform anytime.
No registration, no cloud. All data stored in an environment you control.
- Auto Sync - Automatically sync from Git repositories
- Syntax Highlighting - Code highlighting powered by highlight.js
- Responsive Design - Works on all devices
- Auto TOC - Automatic table of contents generation
- Modern UI - Clean and intuitive interface
- PDF Support - Render PDF files as images
- View Statistics - Track article views
- Lightweight - No database required
- SEO Optimized - Full SEO optimization
- Frontmatter Support - Parse YAML metadata
- Local Images - Support for local images in Markdown
- HTML Articles - Repository HTML files become articles, with a sandbox mode for full interactive pages
- Multi-language - Chinese and English support
- Docker Ready - Full Docker support
- Node.js >= 14.0.0
- Git
# Clone the repository
git clone https://github.com/steven-ld/PowerWiki.git
cd PowerWiki
# Create config file
cp config.example.json config.json
# Edit config.json with your Git repository URL
# Start with Docker Compose
docker-compose up -d# Clone the repository
git clone https://github.com/steven-ld/PowerWiki.git
cd PowerWiki
# Install dependencies
npm install
# Create config file
cp config.example.json config.json
# Edit config.json with your Git repository URL
# Start the server
npm startVisit http://localhost:3150 in your browser.
Edit config.json:
{
"gitRepo": "https://github.com/your-username/your-wiki-repo.git",
"repoBranch": "main",
"port": 3150,
"siteTitle": "My Wiki",
"siteDescription": "Knowledge Base",
"autoSyncInterval": 180000,
"html": {
"enabled": true,
"sanitize": true
},
"pages": {
"home": "README.md",
"about": "ABOUT.md",
"notFound": "404.html"
}
}| Option | Description | Default |
|---|---|---|
gitRepo |
Git repository URL | - |
repoBranch |
Branch name | main |
mdPath |
Markdown files subdirectory | "" |
port |
Server port | 3150 |
siteTitle |
Site title | PowerWiki |
siteDescription |
Site description | Wiki |
autoSyncInterval |
Auto sync interval (ms) | 180000 |
sortOrder |
Sort order (modified or name) |
modified |
pages.home |
Home page file | "" |
pages.about |
About page file | "" |
pages.notFound |
Custom 404 page (.html or .md) |
built-in page |
html.enabled |
Include repository HTML files as articles | true |
html.sanitize |
Sanitize the article body with an allowlist | true |
html.csp |
Override the Content-Security-Policy of the configured 404 page | "" |
HTML files behave like Markdown articles: they appear in the sidebar, are served at /post/docs/page.html, and use the same reading view (TOC, copy, raw view, share link, SEO tags and view counting). Legacy URLs redirect to that article URL with a 301: /docs/page and /docs/page.html → /post/docs/page.html, /docs/ → /post/docs/index.html. Only the <body> is rendered; <title>, <meta name="description"> and <meta name="keywords"> become the article metadata. The configured home page can be an HTML file as well: pages.home accepts .html and is rendered through the same path, and is skipped while html.enabled is false.
The body is sanitized by default — <script>, <style>, <iframe>, forms, inline event handlers and style attributes are removed, and javascript: URLs are dropped. Relative URLs are rewritten server-side: images go to /api/image/..., links to other HTML/Markdown/PDF files go to /post/..., and other assets (such as static/site.css) are resolved from the page's directory, so no Referer is required. Root-absolute URLs (/static/..., /api/image/...) are left unchanged; same-level static/ lookup for them still uses the article page's Referer, which is mapped back to the repository directory. Set html.sanitize to false only for fully trusted content (the legacy html.sandbox: false still works and maps to the same mode). Directories named static/ are not treated as article containers. Repository data files (JSON, YAML, TXT, CSV, XML) are served only from directories named static/; the same-directory asset lookup never exposes them. If pages.notFound is empty or missing, the built-in 404 page is used.
If an HTML file is a complete interactive page (scripts, Canvas, WebGL, forms), opt in from its <head>:
<meta name="powerwiki-render" content="sandbox">The article body is then no longer sanitized; it becomes a controlled iframe: scripts, forms, popups, downloads and user-activated top navigation are allowed, but allow-same-origin is not. The page runs in an opaque origin and cannot read the Wiki's cookies, localStorage or IndexedDB, nor call same-origin APIs. content="full" is accepted as an alias. Keep state in memory, or wrap Web Storage access in try / catch.
The original page is also served at /full/<repo path> with the unsanitized HTML and Content-Security-Policy: sandbox ... plus X-Content-Type-Options: nosniff, so it can be opened in its own tab. That route exposes only HTML and static assets (images, CSS/JS, fonts, audio/video, WASM) and validates paths before resolving them: traversal, hidden path segments, symlinks and files over 50 MB are rejected. Directory URLs such as /full/docs/ and extensionless paths such as /full/docs/guide resolve to index.html and guide.html respectively, so relative links in a full page keep working. HTML files without the meta tag still use the sanitized article mode.
Sandbox pages and an HTML home page open in place as an immersive reading canvas: the iframe is not reloaded, the table of contents stays on desktop, and Esc or the top-right exit button returns to the normal view. The server renders that state from the first frame, so the layout does not jump from a narrow column to full width while loading. Sandbox frames report their content height through postMessage (clamped to 240–20000px), so views that are not immersive do not grow a second scrollbar. Plain HTML articles have no iframe: they scroll as a normal page, and their Full screen button opens the /full/ URL in a new tab. The plain link below the embedded page stays as a no-JS fallback.
Sandboxed pages cannot read the Wiki's data-theme or Web Storage, so the article shell sends them a small context message after the iframe loads and again whenever the site theme changes:
{ type: 'powerwiki:context', version: 1, theme: 'dark', lang: 'zh-CN' }A page that wants to match before first paint can send parent.postMessage({ type: 'powerwiki:request-context' }, '*') and apply the reply. The parent only answers messages coming from the sandbox frames it rendered, and the payload contains no cookies, statistics or repository content. Pages opened directly under /full/ have no parent; fall back to prefers-color-scheme there.
PowerWiki supports environment variables for flexible deployment:
# Configuration file path
CONFIG_PATH=/path/to/your/config.json
# Data storage directory (for stats and logs)
DATA_DIR=/path/to/data/directory
# Git repository cache directory
GIT_CACHE_DIR=/path/to/git/cache
# Language setting (zh-CN or en)
LANG=zh-CNCopy .env.example to .env and customize as needed.
@sayunchuan provides a Docker image for PowerWiki.
- Image:
sayunchuan/powerwiki - Docker Hub: sayunchuan/powerwiki
- Tags:
latest,1.4.5,20260207
# Simplest way
docker run -d -p 3150:3150 sayunchuan/powerwiki
# With custom config
docker run -d \
--name powerwiki \
-p 3150:3150 \
-v $(pwd)/config.json:/app/config.json:ro \
-v powerwiki_data:/app/data \
-v powerwiki_cache:/app/cache \
sayunchuan/powerwikiversion: '3.8'
services:
powerwiki:
image: sayunchuan/powerwiki:latest
ports:
- "3150:3150"
environment:
- NODE_ENV=production
- LANG=zh-CN
volumes:
- ./config.json:/app/config.json:ro
- powerwiki_data:/app/data
- powerwiki_cache:/app/cache
restart: unless-stopped
volumes:
powerwiki_data:
powerwiki_cache:# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downAcknowledgment: Thanks to @sayunchuan for providing the Docker image, making PowerWiki deployment more convenient.
PowerWiki supports hierarchical folder structure for organizing articles:
your-wiki-repo/
├── README.md # Home page
├── ABOUT.md # About page
├── images/ # Global images (optional)
├── Architecture/ # Category folder
│ ├── images/ # Category images
│ ├── IoT-Device-Standards.md
│ ├── TLS-Encryption.md
│ └── README.md # Category index
├── Projects/ # Another category
│ ├── images/
│ ├── URL-Shortener.md
│ └── README.md
└── Media/
├── images/
├── WebRTC-Signaling.md
└── README.md
Each article can include YAML frontmatter for metadata:
---
title: Article Title
description: Article description for SEO
author: Author Name
date: 2026-01-10
updated: 2026-01-10
keywords: keyword1, keyword2, keyword3
tags: [tag1, tag2]
---Set a permanent frontmatter slug to publish an article at /article/getting-started. Keep the slug when moving or renaming the file to preserve its URL and share link. Articles without a slug keep their existing /post/file-path URLs.
---
title: Getting Started
slug: getting-started
aliases:
- /post/old-folder/intro.md
- /article/old-getting-started
---Slugs accept Unicode letters, numbers, underscores and hyphens and must be unique. Aliases support block lists as above or inline lists such as [/post/old.md, /article/old-slug]. Use unencoded local paths without domains, query strings or fragments. Legacy addresses redirect permanently (301), and their share codes remain valid. Add the old path as an alias when renaming: historical paths cannot be recovered without explicit aliases. Invalid or conflicting addresses cause an error; correct the metadata and wait for Git sync.
Browsers and crawlers receive the same article HTML and SEO metadata (canonical, Open Graph, Twitter Card and JSON-LD). RSS and sitemap use the same canonical URLs. Publication and modification dates come from Git; author overrides the site name. Initial article loads reuse server-rendered content without fetching the article again. Missing articles return HTTP 404 with noindex. Address indexes and article bodies remain cached until Git content or configuration changes, or the server restarts.
PowerWiki supports referencing local images using relative paths in Markdown. The system automatically converts image paths to accessible API URLs:
# Method 1: Using images folder in current directory (recommended)

# Method 2: Using parent directory's images folder

# Method 3: Using absolute path (relative to repo root)

# Method 4: Direct reference (without ./ or ../ prefix)
Supported image formats: PNG, JPG/JPEG, GIF, WEBP, SVG, ICO
PowerWiki supports multiple languages for console output and allows users to customize language packs.
- Chinese Simplified (
zh-CN) - Default - English (
en)
# Start with English
LANG=en npm start
# Start with Chinese
LANG=zh-CN npm start
# Or use npm scripts
npm run start:en
npm run start:zhPowerWiki uses JSON files for translations and supports adding custom languages.
Create a new language file in the locales/ directory with the format <language-code>.json:
# Example: Create Japanese language file
cp locales/en.json locales/ja.jsonModify locales/ja.json and replace English translations with Japanese:
{
"siteTitle": "PowerWiki",
"siteDescription": "Wiki システム",
"nav": {
"home": "ホーム",
"about": "概要"
},
"content": {
"readingTime": "読み取り時間",
"words": "語",
"toc": "目次"
},
"actions": {
"copy": "コピー",
"copied": "コピー完了"
},
"stats": {
"views": "閲覧数"
},
"footer": {
"poweredBy": "Powered by"
}
}Modify src/config/i18n.js and add your new language to the SUPPORTED_LANGUAGES array:
const SUPPORTED_LANGUAGES = [
{ code: 'zh-CN', name: '中文', file: 'zh-CN.json' },
{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'ja', name: '日本語', file: 'ja.json' }, // Add Japanese
];# Start with Japanese
LANG=ja npm startLanguage files support the following keys (all are optional, missing keys will fall back to English):
| Category | Key | Description |
|---|---|---|
| Site | siteTitle |
Website title |
| Site | siteDescription |
Website description |
| Nav | nav.home |
Home link text |
| Nav | nav.about |
About page link text |
| Content | content.readingTime |
Reading time label |
| Content | content.words |
Words unit |
| Content | content.toc |
Table of contents title |
| Actions | actions.copy |
Copy button |
| Actions | actions.copied |
Copied success message |
| Stats | stats.views |
View count label |
| Footer | footer.poweredBy |
Powered by text |
# Development
npm run dev # Start with nodemon
npm run test:env # Test environment variables
# Docker
npm run docker:build # Build Docker image
npm run docker:run # Run Docker container
npm run docker:stop # Stop and remove container
npm run docker:logs # View container logs
# Language variants
npm run start:en # Start with English
npm run start:zh # Start with ChinesePowerWiki/
├── src/ # Source code
│ ├── index.js # Express server entry
│ ├── routes/ # Route modules
│ │ ├── api.js # API routes
│ │ ├── feeds.js # RSS/Sitemap routes
│ │ ├── html.js # HTML article redirects & repo assets
│ │ └── static.js # Static file routes
│ ├── config/ # Configuration
│ │ ├── env.js # Environment variables
│ │ └── i18n.js # Internationalization
│ └── utils/ # Utility modules
│ ├── cacheManager.js # Cache management
│ ├── gitManager.js # Git operations
│ ├── htmlArticle.js # HTML article sanitizing & URL rewriting
│ └── markdownParser.js# Markdown parser
├── locales/ # Translation files
│ ├── zh-CN.json # Chinese translations
│ └── en.json # English translations
├── templates/ # HTML templates
│ ├── header.html # Header template
│ ├── footer.html # Footer template
│ └── home.html # Home template
├── public/ # Static assets
│ ├── index.html # Frontend HTML
│ ├── app.js # Main entry (modular)
│ ├── js/ # JavaScript modules
│ │ ├── theme.js # Theme management
│ │ ├── i18n.js # Internationalization
│ │ ├── cache.js # Client caching
│ │ ├── utils.js # Utilities
│ │ ├── posts.js # Post list & tree
│ │ ├── article.js # Article rendering
│ │ ├── toc.js # Table of contents
│ │ └── media.js # Code copy, images, PDF
│ └── css/ # CSS modules
│ ├── base.css # Base styles & variables
│ ├── layout.css # Layout (sidebar, header)
│ ├── sidebar.css # Navigation menu
│ ├── article.css # Article & Markdown
│ ├── toc.css # Table of contents
│ ├── media.css # Responsive design
│ └── components.css # UI components
├── config.example.json # Config template
├── package.json # Dependencies
├── Dockerfile # Docker configuration
└── docker-compose.yml # Docker Compose
- Backend: Express.js
- Frontend: Vanilla JavaScript
- Git: simple-git
- Markdown: marked + highlight.js
- PDF: pdfjs-dist
- Containerization: Docker
MIT License - see LICENSE for details.
- @sayunchuan - Add multi-language, Mermaid support, fix various issues
If this project helps you, please give it a ⭐ Star!





