mdn-server
v1.1.1
Published
A CLI tool to serve and view Markdown files in the browser
Downloads
309
Maintainers
Readme
mdn-server
A CLI tool to serve and view Markdown files in the browser with live reload, search, and table of contents.
Installation
npm install -g mdn-serverUsage
# Serve markdown files from current directory
mdn-server
# Serve from a specific directory
mdn-server ./docs
# Open a specific markdown file
mdn-server ./docs/README.md
# Specify a custom port
mdn-server ./docs --port 4000
# Auto-open browser
mdn-server ./docs --openWhen you pass a markdown file directly, the server serves its parent directory and opens that file automatically.
Then open http://localhost:3000 in your browser.
Features
- Sidebar Navigation - Browse files in a tree structure with folders
- Live Reload - Page updates automatically when you edit markdown files
- Full-Text Search - Search across all files with
Ctrl+K/Cmd+K - Table of Contents - Auto-generated from headings for easy navigation
- Syntax Highlighting - Code blocks are highlighted with highlight.js
- GitHub-Style Rendering - Clean, readable markdown styling
Options
| Option | Description | Default |
|--------|-------------|---------|
| -p, --port <port> | Port to run the server on | 3000 |
| -o, --open | Open browser automatically | false |
| -V, --version | Show version number | |
| -h, --help | Show help | |
Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| Ctrl+K / Cmd+K | Focus search |
| Escape | Close search |
Example
# Create some markdown files
mkdir docs
echo "# Hello World" > docs/index.md
echo "# Getting Started" > docs/getting-started.md
# Start the server
mdn-server docs --openLicense
MIT
