Browse Source

Update deps, switch to marked for markdown

tags/v0.2.0
Dylan Baker 3 years ago
parent
commit
63e45fc49b
3 changed files with 265 additions and 1757 deletions
  1. 244
    1732
      package-lock.json
  2. 11
    11
      package.json
  3. 10
    14
      src/index.ts

+ 244
- 1732
package-lock.json
File diff suppressed because it is too large
View File


+ 11
- 11
package.json View File

@@ -19,18 +19,18 @@
19 19
   "author": "Dylan Baker <dylan@simulacrum.party>",
20 20
   "license": "MIT",
21 21
   "dependencies": {
22
-    "argparse": "^1.0.10",
23
-    "chokidar": "^2.0.4",
24
-    "express": "^4.16.4",
25
-    "remarkable": "^1.7.1",
26
-    "ws": "^6.1.2"
22
+    "argparse": "^2.0.1",
23
+    "chokidar": "^3.5.1",
24
+    "express": "^4.17.1",
25
+    "marked": "^1.2.8",
26
+    "ws": "^7.4.2"
27 27
   },
28 28
   "devDependencies": {
29
-    "@types/argparse": "^1.0.35",
30
-    "@types/chokidar": "^1.7.5",
31
-    "@types/express": "^4.16.0",
32
-    "@types/remarkable": "^1.7.2",
33
-    "@types/ws": "^6.0.1",
34
-    "typescript": "^3.2.4"
29
+    "@types/argparse": "^2.0.5",
30
+    "@types/chokidar": "^2.1.3",
31
+    "@types/express": "^4.17.11",
32
+    "@types/marked": "^1.2.1",
33
+    "@types/ws": "^7.4.0",
34
+    "typescript": "^4.1.3"
35 35
   }
36 36
 }

+ 10
- 14
src/index.ts View File

@@ -3,7 +3,7 @@
3 3
 import { ArgumentParser } from 'argparse';
4 4
 import chokidar from 'chokidar';
5 5
 import express, { Request, Response } from 'express';
6
-import Remarkable from 'remarkable';
6
+import marked from 'marked';
7 7
 import WebSocket from 'ws';
8 8
 
9 9
 import * as fs from 'fs';
@@ -12,27 +12,23 @@ import * as path from 'path';
12 12
 import template from './template';
13 13
 
14 14
 const parser = new ArgumentParser({
15
-  version: '0.1.0',
16
-  addHelp: true,
15
+  add_help: true,
17 16
   description: 'Realtime Markdown preview',
18 17
 });
19 18
 
20
-parser.addArgument('file');
21
-parser.addArgument(
22
-  ['-p', '--port'],
23
-  {
24
-    defaultValue: 1729,
25
-    help: 'The port to run on',
26
-    type: 'int' }
27
-);
19
+parser.add_argument('file');
20
+parser.add_argument('-p', '--port', {
21
+  default: 1729,
22
+  help: 'The port to run on',
23
+  type: 'int',
24
+});
28 25
 
29
-const { file, port } = parser.parseArgs();
26
+const { file, port } = parser.parse_args();
30 27
 const filepath = path.resolve(file);
31 28
 
32 29
 const getRenderedHTML = () => {
33
-  const md = new Remarkable();
34 30
   const fileContents = fs.readFileSync(filepath, 'utf-8');
35
-  return md.render(fileContents);
31
+  return marked(fileContents);
36 32
 };
37 33
 
38 34
 const wss = new WebSocket.Server({

Loading…
Cancel
Save