A simple development-time markdown to HTML renderer.
Check that your markdown files (README.md, LICENSE.md, CONTRIBUTING.md) are properly constructed on your local machine, rather than waiting until you push to discover markdown errors.
npm install --save-dev markdown-viewer
- Generate HTML files (.html) from markdown (.md) files
- Output generated HTML file to a default directory or specify a different output directory
- Option to open the generated HTML in the browser immediately after generating it
<project_dir>/node_modules/.bin/markdown-viewer [OPTIONS]
--file
,-r
: markdown file path, relative to project root; defaults to README.md--output-dir
,-o
: output directory, relative to project root; defaults to .markdown-viewer. Make sure to add .markdown-viewer to your .gitignore and .npmignore files--open
,-b
: if set, opens the generated HTML in the default browser--help
,-h
: show help document
$ <project_dir>/node_modules/.bin/markdown-viewer
: generate README.html from README.md and output to .markdown-viewer/README.html$ <project_dir>/node_modules/.bin/markdown-viewer --open
: generate README.html, output to .markdown-viewer/README.html, and open in browser$ <project_dir>/node_modules/.bin/markdown-viewer --file CONTRIBUTING.md --output-dir docs --open
: generate CONTRIBUTING.html, output to docs/CONTRIBUTING.html, and open in browser
You can add the following stanzas to the scripts section of your package.json file:
"view-readme": "./node_modules/.bin/markdown-viewer -b",
"view-contributing": "./node_modules/.bin/markdown-viewer -f CONTRIBUTING.md -b",
"view-license": "./node_modules/.bin/markdown-viewer -f LICENSE.md -b"
Then you can run:
npm run view-readme
to view the output of README.mdnpm run view-contributing
to view the output of the CONTRIBUTING.md filenpm run view-license
to view the output of the LICENSE.md file