0.6.1 • Published 2 days ago
@mryhryki/markdown-preview v0.6.1
markdown-preview
Markdown realtime preview on browser with your favorite editor.
Demo
Usage
npx
$ npx @mryhryki/markdown-preview --file README.md --template default --port 34567 --log-level info --no-opener
Version : v0.6.0
Root Directory : /current/dir
Default File : README.md
Extensions : md, markdown
Template File : /path/to/template/default.html
Preview URL : http://localhost:34567
npm / yarn
$ npm install -g @mryhryki/markdown-preview
# or
$ yarn install -g @mryhryki/markdown-preview
$ markdown-preview --file README.md --template default-dark --port 34567 --log-level info --no-opener
Version : v0.6.0
Root Directory : /current/dir
Default File : README.md
Extensions : md, markdown
Template File : /path/to/template/default-dark.html
Preview URL : http://localhost:34567
Parameter
short | long | environment variable | parameter | required | default |
---|---|---|---|---|---|
-f | --file | MARKDOWN_PREVIEW_FILE | relative file path | no | README.md |
-t | --template | MARKDOWN_PREVIEW_TEMPLATE | defined template name (1) or template file path (2) | no | default |
-p | --port | MARKDOWN_PREVIEW_PORT | port number | no | 34567 |
--log-level | MARKDOWN_PREVIEW_LOG_LEVEL | trace, debug, infowarn, error, fatal | no | info | |
--no-opener | MARKDOWN_PREVIEW_NO_OPENER | true (only env var) | no | ||
-v | --version | no | |||
-h | --help | no |
*1: Defined Template Names
default
*2: How to create a template file
Creating a template file is easy.
At a minimum, all you need to do is load /markdown-preview-websocket.js
and pass a callback function with the necessary processing to connectMarkdownPreview
.
Sample code is presented below.
<!doctype html>
<html>
<head>
<title>Minimum Template Sample</title>
</head>
<body>
<pre id="raw-markdown"></pre>
<script type="module">
import { connectMarkdownPreview } from "/markdown-preview-websocket.js";
connectMarkdownPreview(({ markdown }) => {
document.getElementById('raw-markdown').innerHTML =
markdown.replace(/</g, '<').replace(/>/g, '>');
});
</script>
</body>
</html>
Development
$ npm install
# Watch mode
$ npm run dev
# Build and Run
$ npm start
# Test
$ npm test
$ npm run test:watch
# Type check
$ npm run type
$ npm run type:watch
# Check code format
$ npm run lint
# Formatter
$ npm run fmt
0.6.1
2 days ago
0.6.0
2 days ago
0.5.9
15 days ago
0.5.8
17 days ago
0.5.7
17 days ago
0.5.6
18 days ago
0.5.4
22 days ago
0.5.5
22 days ago
0.5.3
2 months ago
0.5.2
2 months ago
0.5.1
2 months ago
0.5.0
8 months ago
0.4.1
1 year ago
0.4.3
1 year ago
0.4.2
1 year ago
0.3.2
2 years ago
0.4.0
2 years ago
0.3.11
2 years ago
0.3.10
3 years ago
0.3.8
3 years ago