@mryhryki/markdown-preview 0.5.9 → 0.6.1

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,7 +4,10 @@ Markdown realtime preview on browser with your favorite editor.
4
4
 
5
5
  ## Demo
6
6
 
7
- https://github.com/mryhryki/markdown-preview/assets/12733897/86d27eaa-8b69-48a4-82a5-04f5602925f6
7
+ <video
8
+ style="max-width: 100%; object-fit: contain;"
9
+ src="https://github.com/mryhryki/markdown-preview/assets/12733897/8c7afd39-4d02-4e9a-b84f-863f11630e6b"
10
+ controls></video>
8
11
 
9
12
  ## Usage
10
13
 
@@ -12,6 +15,7 @@ https://github.com/mryhryki/markdown-preview/assets/12733897/86d27eaa-8b69-48a4-
12
15
 
13
16
  ```shell
14
17
  $ npx @mryhryki/markdown-preview --file README.md --template default --port 34567 --log-level info --no-opener
18
+ Version : v0.6.0
15
19
  Root Directory : /current/dir
16
20
  Default File : README.md
17
21
  Extensions : md, markdown
@@ -27,6 +31,7 @@ $ npm install -g @mryhryki/markdown-preview
27
31
  $ yarn install -g @mryhryki/markdown-preview
28
32
 
29
33
  $ markdown-preview --file README.md --template default-dark --port 34567 --log-level info --no-opener
34
+ Version : v0.6.0
30
35
  Root Directory : /current/dir
31
36
  Default File : README.md
32
37
  Extensions : md, markdown
@@ -49,7 +54,6 @@ Preview URL : http://localhost:34567
49
54
  ### *1: Defined Template Names
50
55
 
51
56
  - `default`
52
- - `default-dark`
53
57
 
54
58
  ### *2: How to create a template file
55
59
 
@@ -66,12 +70,11 @@ Sample code is presented below.
66
70
  </head>
67
71
  <body>
68
72
  <pre id="raw-markdown"></pre>
69
- <script src="/markdown-preview-websocket.js"></script>
70
- <script type="text/javascript">
71
- connectMarkdownPreview((changedEvent) => {
72
- const { markdown } = changedEvent;
73
+ <script type="module">
74
+ import { connectMarkdownPreview } from "/markdown-preview-websocket.js";
75
+ connectMarkdownPreview(({ markdown }) => {
73
76
  document.getElementById('raw-markdown').innerHTML =
74
- markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
77
+ markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
75
78
  });
76
79
  </script>
77
80
  </body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mryhryki/markdown-preview",
3
- "description": "Markdown realtime preview on browser",
4
- "version": "0.5.9",
3
+ "description": "Markdown realtime preview on browser with your favorite editor",
4
+ "version": "0.6.1",
5
5
  "author": "mryhryki",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -27,6 +27,20 @@
27
27
  "bin": {
28
28
  "markdown-preview": "index.js"
29
29
  },
30
+ "scripts": {
31
+ "build": "npm run build:server && npm run build:css && npm run build:js",
32
+ "build:server": "tsc",
33
+ "build:css": "cp ./node_modules/github-markdown-css/github-markdown.css ./static/github-markdown.css && cp ./node_modules/highlight.js/styles/github.css ./static/highlightjs-github.css",
34
+ "build:js": "esbuild --bundle --platform=browser --format=esm --outfile=./static/convert-markdown.js ./script/convert-markdown.ts",
35
+ "fmt": "prettier --write ./src/**/*.ts ./**/*.html && eslint ./src/**/*.ts --fix",
36
+ "lint": "prettier --check ./src/**/*.ts ./**/*.html && eslint ./src/**/*.ts",
37
+ "release": "npm run build && npm publish",
38
+ "start": "npm run build && node ./index.js",
39
+ "test": "jest",
40
+ "test:watch": "jest --watchAll",
41
+ "type": "tsc --noEmit",
42
+ "type:watch": "tsc --noEmit --watch"
43
+ },
30
44
  "dependencies": {
31
45
  "express": "^4.19.2",
32
46
  "express-ws": "^5.0.2",
@@ -41,6 +55,8 @@
41
55
  "@types/jest": "^29.5.12",
42
56
  "@types/opener": "^1.4.3",
43
57
  "@types/serve-index": "^1.9.4",
58
+ "emojilib": "^3.0.12",
59
+ "esbuild": "^0.21.1",
44
60
  "eslint": "^8.57.0",
45
61
  "eslint-config-prettier": "^9.1.0",
46
62
  "eslint-plugin-jest": "^28.2.0",
@@ -50,23 +66,17 @@
50
66
  "eslint-plugin-react-hooks": "^4.6.0",
51
67
  "eslint-plugin-simple-import-sort": "^12.1.0",
52
68
  "eslint-plugin-unused-imports": "^3.1.0",
69
+ "github-markdown-css": "^5.5.1",
70
+ "highlight.js": "^11.9.0",
53
71
  "jest": "^29.7.0",
72
+ "marked": "^12.0.2",
73
+ "marked-emoji": "^1.4.0",
74
+ "marked-highlight": "^2.1.1",
75
+ "mermaid": "^10.9.0",
54
76
  "nodemon": "^3.1.0",
55
77
  "ts-jest": "^29.1.2",
56
78
  "typescript": "^5.4.5"
57
79
  },
58
- "scripts": {
59
- "build": "tsc",
60
- "dev": "nodemon --watch ./src/ --ext 'ts' --exec 'npm start -- --no-opener --log-level debug'",
61
- "fmt": "prettier --write ./src/**/*.ts ./**/*.html && eslint ./src/**/*.ts --fix",
62
- "lint": "prettier --check ./src/**/*.ts ./**/*.html && eslint ./src/**/*.ts",
63
- "release": "npm run build && npm publish",
64
- "start": "npm run build && node ./index.js",
65
- "test": "jest",
66
- "test:watch": "jest --watchAll",
67
- "type": "tsc --noEmit",
68
- "type:watch": "tsc --noEmit --watch"
69
- },
70
80
  "files": [
71
81
  "index.js",
72
82
  "src/**/*.js",
package/src/index.js CHANGED
@@ -21,6 +21,7 @@ try {
21
21
  (0, show_1.showVersion)();
22
22
  const logger = (0, logger_1.getLogger)(params.logLevel);
23
23
  const previewUrl = `http://localhost:${params.port}`;
24
+ console.log("Version :", (0, show_1.getVersion)());
24
25
  console.log("Root Directory :", directory_1.rootDir);
25
26
  console.log("Default File :", params.filepath);
26
27
  console.log("Extensions :", params.extensions.join(", "));
package/src/lib/show.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.showVersion = exports.showUsage = void 0;
26
+ exports.showVersion = exports.getVersion = exports.showUsage = void 0;
27
27
  const pkg = __importStar(require("../../package.json"));
28
28
  function showUsage(error = false) {
29
29
  const usage = `
@@ -42,8 +42,12 @@ Options:
42
42
  process.exit(error ? 1 : 0);
43
43
  }
44
44
  exports.showUsage = showUsage;
45
+ function getVersion() {
46
+ return `v${pkg.version}`;
47
+ }
48
+ exports.getVersion = getVersion;
45
49
  function showVersion() {
46
- console.log(pkg.version);
50
+ console.log(getVersion());
47
51
  process.exit(0);
48
52
  }
49
53
  exports.showVersion = showVersion;