mdprev
v0.0.3
Published
Small local Markdown preview server with live reload.
Readme
mdprev
Small local Markdown preview server with live reload.
Features
- Renders GitHub Flavored Markdown (GFM): tables, strikethrough, autolink literals, and task lists.
- Auto-reloads the browser when the file changes.
- Sanitizes HTML output via DOMPurify.
- Supports multiple Markdown files with in-browser navigation.
Install
Install it globally from npm:
npm install -g mdprevInstall from local source during development:
pnpm install
pnpm link --globalUsage
mdprev README.mdMultiple files:
mdprev README.md docs/notes.md README-GFM.mdYou can also run it directly:
node main.mjs README.mdOptions:
--port <number>: Bind to a specific port (default is random).--no-open: Do not auto-open a browser tab.
Examples:
mdprev docs/notes.md --port 3456
mdprev README.md --no-open
mdprev chapter1.md chapter2.md chapter3.md --port 3456The server only binds to 127.0.0.1 and prints the URL on startup.
Release and npm Publish Automation
This repo is configured to publish to npm when you publish a GitHub Release.
One-time setup:
- In npm, create an automation token:
- npmjs.com -> Account Settings -> Access Tokens -> Generate New Token -> Automation
- In GitHub, add the token as a repository secret:
- Settings -> Secrets and variables -> Actions -> New repository secret
- Name:
NPM_TOKEN
- Ensure your npm package name (
mdprev) is available to your npm account/org.
How to release:
- Bump version in
package.json(or runnpm version patch|minor|major). - Commit and push to GitHub.
- Create and publish a GitHub Release with tag
vX.Y.Z(example:v0.0.4). - GitHub Actions workflow
.github/workflows/release-npm.ymlpublishes that version to npm.
Notes:
- The workflow requires the release tag version to match
package.jsonversion. - Pre-releases are skipped by default (
prerelease == false).
