readme-preview
v1.0.2
Published
Preview and validate how your README renders on npm and GitHub before publishing.
Maintainers
Readme
readme-preview
Preview, validate, and prepare your README for npm and GitHub before publishing.
readme-preview helps you:
- 👀 Preview how Markdown renders
- 🧹 Rewrite relative assets & links to working raw URLs
- ✅ Lint & validate README quality (CI-ready)
- ⚡ Bootstrap docs & CI with a single
initcommand
Designed to be tiny, fast, and zero-config.
Install
No install required:
npx readme-previewOr add as a dev dependency:
npm i -D readme-previewQuick Start
Preview your README in a browser:
npx readme-previewRun CI-style validation:
npx readme-preview check --strictBootstrap README badges + GitHub Action:
npx readme-preview init --assetsCommands
preview (default)
Render README in a local browser preview.
npx readme-previewOptions:
--file <path> Markdown file (default: README.md)
--port <number> Preview port (default: 4173)
--no-open Do not open browser
--theme <npm|github> Visual theme (default: npm)
--branch <name> Git branch for raw URLs (default: HEAD)
--base-url <url> Override raw base URL
--rewrite-links Rewrite relative markdown linksExamples
Preview a docs README:
npx readme-preview --file docs/README.mdUse GitHub theme:
npx readme-preview --theme githubRewrite links + images using main branch:
npx readme-preview --branch main --rewrite-linksPreview GitLab repo:
npx readme-preview --base-url https://gitlab.com/user/repo/-/raw/main/build
Generate static HTML preview:
npx readme-preview buildOutput:
.readme-preview/index.htmlUseful for:
- CI artifacts\
- documentation previews\
- static hosting
check
Run README validation rules.
npx readme-preview checkExit code:
0→ pass\1→ issues found
Strict mode
npx readme-preview check --strictStrict checks include:
- Missing H1 title
- Relative images
- README too short
- Missing code blocks
- Missing description under H1
- Raw HTML usage
- Missing Install section
- Missing Usage section
Perfect for CI enforcement.
init
Bootstrap README quality setup.
npx readme-preview initCreates or updates:
- GitHub Action workflow\
- README badges section\
- Screenshot section\
- Quick start examples
Options
--assets Add placeholder screenshot
--workflow-only Only create GitHub Action
--readme-only Only patch README
--force Overwrite existing files
--workflow-name Custom workflow nameExamples
Full setup:
npx readme-preview init --assetsOnly CI workflow:
npx readme-preview init --workflow-onlyOverwrite existing:
npx readme-preview init --forceAsset & Link Rewriting
Relative paths like:

[Guide](./docs/guide.md)Can be rewritten to:
https://raw.githubusercontent.com/user/repo/HEAD/assets/demo.png
https://raw.githubusercontent.com/user/repo/HEAD/docs/guide.mdControlled by:
--branch
--base-url
--rewrite-linksWorks with:
- GitHub\
- GitLab\
- Self-hosted repos
Themes
Switch rendering style:
--theme npm
--theme githubUseful for matching:
- npm package page\
- GitHub README view
CI Integration
Typical GitHub Action step:
- name: README checks
run: npx readme-preview check --strictThis ensures:
- Broken docs never reach
main - README quality stays high
- Contributors follow standards automatically
Why use readme-preview?
Most projects discover README problems after publishing.
This tool lets you:
- Catch rendering issues before npm release
- Enforce documentation quality in CI
- Provide working screenshots & links
- Bootstrap professional README structure instantly
All in a tiny CLI with no config .
Philosophy
Small tools.
Real problems.
Zero friction.
License
MIT
