md-dev-server
Yet another live-reload server for markdown.
In the screenshot, ttyd and Vivaldi browser's Tab Tiling functionality is used to place both terminal and rendering result in one page.
Features
- Simple but enough
- Zero configuration, but customizable
- One executable, no dependency
- GitHub Flavored Markdown by default
Installation
Go to Releases.
Usage
Yet another live-reload server for markdown.
md-dev-server [options] <file-path>
Options:
-help
Show help
-port int
Port of the server (default 3000)
-quiet
Discard all logs
-template string
Path to HTML template
-version
Show version
Example
md-dev-server ./README.md
Then open localhost:3000.
How to live coding
md-dev-server --quiet README.md & # Run quietly in background
vivaldi http://localhost:3000 & # Open localhost:3000 in your favorite browser
micro README.md # Edit file in your favorite editor
Every time you save the file, browser will be reloaded with new content.
How to control logging
With --quiet
option, all logs are discarded.
In order to keep quiet but save logs in a file, use redirect:
md-dev-server README.md &> livereaload.log
Or, to enable both showing logs on screen and saving it to a file simultaniously, use tee
:
md-dev-server README.md | tee livereload.log
To discard informational logs only, redirect stdout to /dev/null
:
md-dev-server README.md > /dev/null
How to customize template
By -template
option, you can alternate HTML template using text/template.
Default template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}}</title>
<script defer src="http://localhost:35729/livereload.js"></script>
<link rel='stylesheet' type='text/css' href='https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css'>
</head>
<body>
<main class="markdown-body">{{.Content}}</main>
</body>
</html>
Template variables
Variable |
Type |
Description |
.Content |
String |
Rendered markdown content |
.Title |
String |
Title of the markdown file |
Contribution
TBA
License
MIT License