Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ytkj/md-browser-preview
Preview markdown text in web browser
https://github.com/ytkj/md-browser-preview
markdown markdown-to-html markdown-viewer
Last synced: 4 days ago
JSON representation
Preview markdown text in web browser
- Host: GitHub
- URL: https://github.com/ytkj/md-browser-preview
- Owner: ytkj
- Created: 2016-06-26T05:59:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T20:20:23.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T13:08:17.430Z (9 months ago)
- Topics: markdown, markdown-to-html, markdown-viewer
- Language: JavaScript
- Homepage:
- Size: 555 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# md-browser-preview
Preview markdown text in web browser.
Compile .md into .html, then launch local web server and default web browser in your system.
Compilation and reloading browser is automatically done when saving .md file.## Install
1. `npm install -g md-browser-preview`
1. `md-browser-preview xxx.md`## Usage
### CLI
Usage:
> md-browser-preview [options] [filename]Options:
-o, --output where to output compiled html file [string] [default: false]
-p, --port port listen on for inner local web server [number] [default: 5000]
-b, --browser web browser to launch in your system [string] [default: "default"]
-t, --title title of generated html document [string] [default: "md-browser-preview"]
-g, --gfm use github favored markdown [boolean] [default: true]
-s, --style highlight.js style sheet name [string] [default: "github"]
-h, --help show this help menu [boolean]### Node.js Programming
#### Basic Usage
```javascript
const MdBrowserPreview = require('md-browser-preview');MdBrowserPreview.init({
input: './target.md',
output: '.'
});
```#### Advanced Usage
```javascript
const MdBrowserPreview = require('md-browser-preview');// instanciate
let mbp = new MdBrowserPreview({
input: './target.md',
output: '.'
});// compile, launch local server and browser, then start watching.
mbp.compile().then(() => {
return mbp.serve();
}).then(() => {
mbp.startWatch();
});// exit local server and stop watching.
mbp.exit();
```## Development
1. `git clone https://github.com/ytkj/md-browser-preview.git`
1. `cd md-browser-preview`
1. `npm install`
1. `npm link`