Markserv
🏁 serve markdown as html (GitHub style), index directories, live-reload as you edit
Install / Use
/learn @markserv/MarkservREADME
<p align="center"> <img alt="Markserv Demo" src="media/markserv-demo.gif" width="100%"> </p>:checkered_flag: serve markdown as html (GitHub style), index directories, and hot-reload as you edit
:sparkles: Features
- Markdown content rendered as HTML
- GitHub flavor CSS and Syntax Highlighting
- Just in Time Templating: Markdown, HTML & LESS
- Hot-reload as you edit (no browser plugin required)
- Directory indexes
- MIME Type file support
Supporting: MathJax, Chinese Characters, Table of Contents, Tables, Heading Anchors
<p align="center"> <img alt="Markserv directory index" src="media/markserv-directory-listing.png" width="100%"> </p>:computer: Installation
# NPM
$ npm i -g markserv
# Yarn
$ yarn global add markserv
:joystick: Usage
To start Markserv from the CLI
# Open closest README.md
$ readme
# Open file
$ markserv README.md
# Open a directory
$ markserv node_modules
<p align="center">
<img alt="Markserv CLI Splash" src="media/markserv-splash.png" width="100%">
</p>
Start Markserv and open a file or directory.
# File
$ markserv ./path/to/file.md
# Directory
$ markserv ./
Start Markserv and open the closest README.md file in the browser:
$ readme
:zap: Hot Reload
Markserv includes built-in hot-reload via WebSocket. When you save a Markdown file, the page content updates instantly without a full page reload and without any browser plugin.
To disable hot-reload, use --no-hotreload:
markserv --no-hotreload README.md
<p align="center">
<img alt="Markserv Live Reload" src="media/markserv-live-reload.gif" width="100%">
</p>
:art: Themes
Markserv ships with four themes: dark (default), light, synthwave, and solarized. You can set the theme from the CLI:
# Use light theme
markserv --light README.md
# Use synthwave theme
markserv --synthwave README.md
# Or use the --theme flag for any theme
markserv --theme solarized README.md
You can also toggle between themes in the browser using the theme button in the bottom-right corner. Your choice is saved in localStorage and persists across hot-reloads.
:link: Markdown Links
You can link to an external Markdown file in the same way that you use GitHub Wiki links. You can use the example code here to see how external links work.
Example code:
[Skateboarding Dog!](tests/Linked-Markdown-Example.md)
Example link:
:stopwatch: Just in Time Templating
Markserv allows you to include nested content using --templates. Templates are fetched and rendered when you request them in your browser. The maxDepth of includes is set to 10.
Note: Templating is disabled by default. Enable it with --templates:
markserv --templates README.md
If you would like to look at an example, you can look in the tests/templates directory of this repo.
To see the server output of this templating example:
$ git clone@github.com/f1lt3r/markserv.git
$ cd markserv
$ markserv --templates tests/templates/index.html
Include Markdown
Note: Any markdown files that you include will be transformed to HTML.
Where foo/bar/baz/qux.md equals:
## Qux
And Markserv renders the following content:
# Include Markdown
{markdown: foo/bar/baz/qux.md}
The server response will be:
<h1>Include Markdown</h1>
<h2>Foo Bar</h2>
Include HTML
Where foo/bar/baz/qux.html equals:
<h2>Qux</h2>
And Markserv renders the following content:
# Include Markdown
{html: foo/bar/baz/qux.html}
The server response will be:
<h1>Include Markdown</h1>
<h2>Qux</h2>
Include LESS
Note: Any LESS files that you include will be transformed to CSS.
Where foo/bar/baz/qux.css equals:
@link-color: green;
a {color: @link-color}
And Markserv renders the following content:
<style>{less: foo/bar/baz/qux.css}</style>
The server response will be:
<style>
a {
color: #008000;
}
</style>
:crossed_flags: Flags
To list the options/flags for the markserv CLI tool:
$ markserv --help
Changing the HTTP Port
You can change the HTTP Port like this:
markserv -p 80
Making Markserv available to external networks
In some cases localhost might be the address on which the server is listening, in which case it is hard to make the site available to external networks even with the right IP. Use the following as an example to make sure the server is accessible from external networks:
markserv -p 8642 -a 0.0.0.0
Above example runs the server on port 8642 and it can be accessed from external networks using public IP of the machine on which the server is running. If you want the server to keep running in a seperate thread even when you log out, use this:
nohup markserv -p 8642 -a 0.0.0.0 &
This will make the server instance persistent and will be available to access even when you log out or even when your ssh session closes (in case you are accessing a remote machine through ssh to set up markserv server)
:cupid: Credits
- Logos used in the directory list: PKief - vscode-material-icon-theme
Contributors
Thanks goes to these wonderful people (emoji key):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="https://f1lt3r.io"><img src="https://avatars1.githubusercontent.com/u/1218446?v=4" width="100px;" alt=""/><br /><sub><b>Alistair MacDonald</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=F1LT3R" title="Code">💻</a></td> <td align="center"><a href="https://finenet.com.tw"><img src="https://avatars3.githubusercontent.com/u/154892?v=4" width="100px;" alt=""/><br /><sub><b>陳瀛洲</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=ChenYingChou" title="Code">💻</a></td> <td align="center"><a href="https://kflu.github.io/"><img src="https://avatars2.githubusercontent.com/u/1031978?v=4" width="100px;" alt=""/><br /><sub><b>Kefei Lu</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=kflu" title="Code">💻</a></td> <td align="center"><a href="https://www.imyzf.com"><img src="https://avatars1.githubusercontent.com/u/8298849?v=4" width="100px;" alt=""/><br /><sub><b>Zhenfei You</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=imyzf" title="Code">💻</a></td> <td align="center"><a href="https://github.com/anslzo"><img src="https://avatars2.githubusercontent.com/u/11443948?v=4" width="100px;" alt=""/><br /><sub><b>Andrew</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=anslzo" title="Code">💻</a></td> <td align="center"><a href="https://daniel.perez.sh"><img src="https://avatars2.githubusercontent.com/u/1436271?v=4" width="100px;" alt=""/><br /><sub><b>Daniel Perez</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=danhper" title="Code">💻</a></td> <td align="center"><a href="https://github.com/sushruth"><img src="https://avatars0.githubusercontent.com/u/2114206?v=4" width="100px;" alt=""/><br /><sub><b>Sushruth Shastry</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=sushruth" title="Code">💻</a></td> </tr> <tr> <td align="center"><a href="https://ptkdev.it"><img src="https://avatars1.githubusercontent.com/u/442844?v=4" width="100px;" alt=""/><br /><sub><b>Patryk Rzucidło</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=ptkdev" title="Code">💻</a></td> <td align="center"><a href="https://github.com/EstebanMarin"><img src="https://avatars3.githubusercontent.com/u/13613037?v=4" width="100px;" alt=""/><br /><sub><b>EstebanMarin</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=EstebanMarin" title="Code">💻</a></td> <td align="center"><a href="https://matthewreishus.com/"><img src="https://avatars3.githubusercontent.com/u/937354?v=4" width="100px;" alt=""/><br /><sub><b>Matthew Reishus</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=mreishus" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/danielwe"><img src="https://avatars3.githubusercontent.com/u/58Related Skills
apple-reminders
347.0kManage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.
gh-issues
347.0kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
347.0kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
