@mryhryki/markdown-preview 0.5.9 → 0.6.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
@@ -49,7 +49,6 @@ Preview URL : http://localhost:34567
49
49
  ### *1: Defined Template Names
50
50
 
51
51
  - `default`
52
- - `default-dark`
53
52
 
54
53
  ### *2: How to create a template file
55
54
 
@@ -66,12 +65,11 @@ Sample code is presented below.
66
65
  </head>
67
66
  <body>
68
67
  <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;
68
+ <script type="module">
69
+ import { connectMarkdownPreview } from "/markdown-preview-websocket.js";
70
+ connectMarkdownPreview(({ markdown }) => {
73
71
  document.getElementById('raw-markdown').innerHTML =
74
- markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
72
+ markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
75
73
  });
76
74
  </script>
77
75
  </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.0",
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;