3 Commits

Author SHA1 Message Date
  Dylan Baker 99cf025910 0.2.0 3 years ago
  Dylan Baker 63e45fc49b Update deps, switch to marked for markdown 3 years ago
  Dylan Baker 010c9a7ec2 Update repo 3 years ago
3 changed files with 268 additions and 1760 deletions
  1. 245
    1733
      package-lock.json
  2. 13
    13
      package.json
  3. 10
    14
      src/index.ts

+ 245
- 1733
package-lock.json
File diff suppressed because it is too large
View File


+ 13
- 13
package.json View File

@@ -1,11 +1,11 @@
1 1
 {
2 2
   "name": "markarth",
3
-  "version": "0.1.0",
3
+  "version": "0.2.0",
4 4
   "description": "Live preview local Markdown files in the browser",
5 5
   "main": "dist/index.js",
6 6
   "repository": {
7 7
     "type": "git",
8
-    "url": "https://git.sr.ht/~simulacrumparty/markarth"
8
+    "url": "https://git.simulacrum.party/simulacrumparty/markarth"
9 9
   },
10 10
   "bin": {
11 11
     "markarth": "dist/index.js"
@@ -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