@mryhryki/markdown-preview 0.3.11 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,51 +4,52 @@ Markdown realtime preview on browser with your favorite editor.
4
4
 
5
5
  ## Demo
6
6
 
7
- ![DEMO](https://github.com/mryhryki/markdown-preview/raw/master/gif/demo.gif)
7
+ ![DEMO](./gif/demo.gif)
8
8
 
9
9
  ## Usage
10
10
 
11
11
  ### npx
12
12
 
13
- ```
14
- $ npx @mryhryki/markdown-preview --port 34567 --file README.md
15
-
13
+ ```shell
14
+ $ npx @mryhryki/markdown-preview --file README.md --template default --port 34567 --log-level info --no-opener
16
15
  Root Directory : /current/dir
17
16
  Default File : README.md
18
- Preview URL : http://localhost:34567/
17
+ Extensions : md, markdown
18
+ Template File : /path/to/template/default.html
19
+ Preview URL : http://localhost:34567
19
20
  ```
20
21
 
21
22
  ### npm / yarn
22
23
 
23
- ```
24
+ ```shell
24
25
  $ npm install -g @mryhryki/markdown-preview
25
26
  # or
26
27
  $ yarn install -g @mryhryki/markdown-preview
27
28
 
28
- $ markdown-preview --port 34567 --file README.md
29
-
29
+ $ markdown-preview --file README.md --template default --port 34567 --log-level info --no-opener
30
30
  Root Directory : /current/dir
31
31
  Default File : README.md
32
- Preview URL : http://localhost:34567/
32
+ Extensions : md, markdown
33
+ Template File : /path/to/template/default.html
34
+ Preview URL : http://localhost:34567
33
35
  ```
34
36
 
35
37
  ## Parameter
36
38
 
37
- | short | long | environment variable | parameter | required | default |
38
- |-------|-------------|----------------------------|------------------------------------------|----------|-----------|
39
- | -f | --file | MARKDOWN_PREVIEW_FILE | `relative` file path | no | README.md |
40
- | -t | --template | MARKDOWN_PREVIEW_TEMPLATE | template name(*1) | no | default |
41
- | -p | --port | MARKDOWN_PREVIEW_PORT | port number | no | 34567 |
42
- | | --log-level | MARKDOWN_PREVIEW_LOG_LEVEL | trace, debug, info<br>warn, error, fatal | no | info |
43
- | | --no-opener | MARKDOWN_PREVIEW_NO_OPENER | true (only env var) | no | |
44
- | -v | --version | | | no | |
45
- | -h | --help | | | no | |
46
-
47
- *1: defined template name or html file path.
39
+ | short | long | environment variable | parameter | required | default |
40
+ |-------|-------------|----------------------------|--------------------------------------------------|----------|-----------|
41
+ | -f | --file | MARKDOWN_PREVIEW_FILE | ***relative*** file path | no | README.md |
42
+ | -t | --template | MARKDOWN_PREVIEW_TEMPLATE | defined template name (*1) or template file path | no | default |
43
+ | -p | --port | MARKDOWN_PREVIEW_PORT | port number | no | 34567 |
44
+ | | --log-level | MARKDOWN_PREVIEW_LOG_LEVEL | trace, debug, info<br>warn, error, fatal | no | info |
45
+ | | --no-opener | MARKDOWN_PREVIEW_NO_OPENER | true (only env var) | no | |
46
+ | -v | --version | | | no | |
47
+ | -h | --help | | | no | |
48
48
 
49
- ### Defined Template Names
49
+ ### *1: Defined Template Names
50
50
 
51
- * `default`
51
+ - `default`
52
+ - `default-dark`
52
53
 
53
54
  ## Minimum Customized Template
54
55
 
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
2
  "name": "@mryhryki/markdown-preview",
3
- "version": "0.3.11",
4
3
  "description": "Markdown realtime preview on browser",
5
- "main": "index.js",
6
- "engines": {
7
- "node": ">=12.0.0",
8
- "npm": ">=6.0.0"
9
- },
10
- "bin": {
11
- "markdown-preview": "index.js"
12
- },
13
- "scripts": {
14
- "start": "nodemon --watch ./src/ index.js --no-opener --log-level debug",
15
- "test": "jest",
16
- "test:watch": "jest --watchAll"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/mryhryki/markdown-preview.git"
21
- },
4
+ "version": "0.4.0",
22
5
  "author": "mryhryki",
23
6
  "license": "MIT",
24
- "publishConfdddig": {
7
+ "publishConfig": {
25
8
  "access": "public"
26
9
  },
27
- "bugs": {
28
- "url": "https://github.com/mryhryki/markdown-preview/issues"
29
- },
30
- "homepage": "https://github.com/mryhryki/markdown-preview#readme",
31
10
  "keywords": [
32
11
  "markdown",
33
12
  "preview"
34
13
  ],
14
+ "homepage": "https://github.com/mryhryki/markdown-preview#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/mryhryki/markdown-preview.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/mryhryki/markdown-preview/issues"
21
+ },
22
+ "engines": {
23
+ "node": ">=12.0.0",
24
+ "npm": ">=6.0.0"
25
+ },
26
+ "main": "index.js",
27
+ "bin": {
28
+ "markdown-preview": "index.js"
29
+ },
35
30
  "dependencies": {
36
- "express": "^4.17.2",
31
+ "express": "^4.18.2",
37
32
  "express-ws": "^5.0.2",
38
- "log4js": "^6.3.0",
33
+ "log4js": "^6.7.0",
39
34
  "opener": "^1.5.2",
40
- "requires": "^1.0.2",
41
35
  "serve-index": "^1.9.1",
42
- "ws": "^8.4.0"
36
+ "ws": "^8.9.0"
43
37
  },
44
38
  "devDependencies": {
45
- "jest": "^27.4.5",
46
- "nodemon": "^2.0.15"
39
+ "jest": "^29.1.2",
40
+ "nodemon": "^2.0.20"
41
+ },
42
+ "scripts": {
43
+ "start": "node ./index.js",
44
+ "dev": "nodemon --watch ./src/ index.js --no-opener --log-level debug",
45
+ "test": "jest",
46
+ "test:watch": "jest --watchAll"
47
47
  }
48
48
  }
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Markdown Preview</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown-dark.min.css">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/github-dark-dimmed.min.css">
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>
10
+ </head>
11
+ <body style="margin: 0 auto; max-width: 882px; padding: 32px; background-color: #0d1117;">
12
+ <div class="markdown-body">
13
+ <div id="content"></div>
14
+ </div>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.1.1/marked.min.js"></script>
16
+ <script src="/markdown-preview-websocket.js"></script>
17
+ <script type="text/javascript">
18
+ connectMarkdownPreview(({ markdown }) => {
19
+ document.getElementById('content').innerHTML = marked.parse(markdown);
20
+ document.querySelectorAll('pre code').forEach(block => hljs.highlightBlock(block));
21
+ });
22
+ </script>
23
+ </body>
24
+ </html>
@@ -4,15 +4,15 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Markdown Preview</title>
7
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.css">
8
- <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/styles/github.min.css">
9
- <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/highlight.min.js"></script>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/github.min.css">
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>
10
10
  </head>
11
11
  <body style="margin: 0 auto; max-width: 882px; padding: 32px;">
12
12
  <div class="markdown-body">
13
13
  <div id="content"></div>
14
14
  </div>
15
- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.1.1/marked.min.js"></script>
16
16
  <script src="/markdown-preview-websocket.js"></script>
17
17
  <script type="text/javascript">
18
18
  connectMarkdownPreview(({ markdown }) => {