mdts 0.10.0 → 0.12.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.
Files changed (70) hide show
  1. package/dist/frontend/0108e89c9003e8c14ea3.woff +0 -0
  2. package/dist/frontend/02271ec5cb9f5b4588ac.woff +0 -0
  3. package/dist/frontend/073b3402d036714b4370.woff +0 -0
  4. package/dist/frontend/0c3b8929d377c0e9b2f3.woff +0 -0
  5. package/dist/frontend/172d3529b26f8cedef6b.woff2 +0 -0
  6. package/dist/frontend/20f389c4120be058d80a.woff2 +0 -0
  7. package/dist/frontend/2960900c4f271311eb36.woff2 +0 -0
  8. package/dist/frontend/2f7bc363fc5424ebda59.ttf +0 -0
  9. package/dist/frontend/354501bac435c3264834.woff +0 -0
  10. package/dist/frontend/39890742bc957b368704.woff2 +0 -0
  11. package/dist/frontend/3a99e70aee4076660d38.woff +0 -0
  12. package/dist/frontend/3f07ed67f06c720120ce.woff +0 -0
  13. package/dist/frontend/428978dc7837d46de091.woff +0 -0
  14. package/dist/frontend/4ad7c7e8bb8d10a34bb7.ttf +0 -0
  15. package/dist/frontend/4c6b94fd1d07f8beff7c.woff +0 -0
  16. package/dist/frontend/4c761b3711973ab04edf.ttf +0 -0
  17. package/dist/frontend/4f35fbcc9ee8614c2bcc.woff +0 -0
  18. package/dist/frontend/57f5c1837853986ea1db.ttf +0 -0
  19. package/dist/frontend/5b49f4993ae22d7975b4.ttf +0 -0
  20. package/dist/frontend/6d3d25f4820d0da8f01f.woff2 +0 -0
  21. package/dist/frontend/6de7d4b539221a49e9e2.ttf +0 -0
  22. package/dist/frontend/6eec866c69313624be60.woff2 +0 -0
  23. package/dist/frontend/6fdf0ac577be0ba82a4c.woff +0 -0
  24. package/dist/frontend/73ea273a72f4aca30ca5.woff2 +0 -0
  25. package/dist/frontend/7489a2fbfb9bfe704420.ttf +0 -0
  26. package/dist/frontend/7947224e8a9914fa332b.woff +0 -0
  27. package/dist/frontend/7d393d382f3e7fb1c637.woff2 +0 -0
  28. package/dist/frontend/7e873d3833eb108a0758.ttf +0 -0
  29. package/dist/frontend/8169508bf58f8bd92ad8.ttf +0 -0
  30. package/dist/frontend/828abcb200061cffbaae.ttf +0 -0
  31. package/dist/frontend/853be92419a6c3766b9a.ttf +0 -0
  32. package/dist/frontend/8a5f936332e8028c7278.ttf +0 -0
  33. package/dist/frontend/8d593cfaa96238d5e2f8.woff +0 -0
  34. package/dist/frontend/8d6b6822586eea3d3b20.ttf +0 -0
  35. package/dist/frontend/931d67ea207ab37ee693.woff2 +0 -0
  36. package/dist/frontend/95591a929f0d32aa282a.woff2 +0 -0
  37. package/dist/frontend/96759856b4e70f3a8338.woff +0 -0
  38. package/dist/frontend/9eba1d77abcf2aa6e94e.ttf +0 -0
  39. package/dist/frontend/a1abf90dfd72792a577a.woff2 +0 -0
  40. package/dist/frontend/aeffd8025cba3647f1a6.woff +0 -0
  41. package/dist/frontend/b257a18c016f37ee4543.ttf +0 -0
  42. package/dist/frontend/b9cd458ac6d5889ff9c3.woff +0 -0
  43. package/dist/frontend/bf2d440b3a42ea78a998.ttf +0 -0
  44. package/dist/frontend/bundle.js +1067 -176
  45. package/dist/frontend/c295e7f71970f03c0549.woff2 +0 -0
  46. package/dist/frontend/c5c02d763c89380dcb4e.ttf +0 -0
  47. package/dist/frontend/c81d1b2a4b75d3eded60.woff2 +0 -0
  48. package/dist/frontend/cd5e231e0cc53b2cb2c0.woff2 +0 -0
  49. package/dist/frontend/d562e886c52f12660a41.woff +0 -0
  50. package/dist/frontend/d6484fce1ef428d5bd94.woff2 +0 -0
  51. package/dist/frontend/d757c535a2e5902f1325.woff +0 -0
  52. package/dist/frontend/db074fa22cf224af93d7.woff +0 -0
  53. package/dist/frontend/dcbcbd93bac0470b462d.woff2 +0 -0
  54. package/dist/frontend/e1951519f6f0596f7356.woff2 +0 -0
  55. package/dist/frontend/e418bf257af1052628d8.woff2 +0 -0
  56. package/dist/frontend/ed305b5434865e06ffde.ttf +0 -0
  57. package/dist/frontend/f650f111a3b890d116f1.woff2 +0 -0
  58. package/dist/frontend/fa675e5e4bec9eb250b6.ttf +0 -0
  59. package/dist/frontend/fc9ba5249878cd8f8d88.ttf +0 -0
  60. package/dist/frontend/fd947498bc16392e76c2.woff +0 -0
  61. package/dist/frontend/fe2176f79edaa716e621.woff2 +0 -0
  62. package/dist/frontend/index.html +1 -0
  63. package/dist/frontend/logo.svg +4 -4
  64. package/dist/frontend/markdown.css +17 -9
  65. package/dist/server/config.js +3 -1
  66. package/dist/server/public/logo.svg +4 -4
  67. package/dist/server/routes/outline.js +18 -14
  68. package/dist/utils/logger.js +2 -2
  69. package/package.json +12 -5
  70. package/dist/frontend/vendors-node_modules_katex_dist_katex_mjs.bundle.js +0 -22
@@ -5,6 +5,7 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
8
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:300,400,500,700&display=swap" />
8
9
  <link rel="stylesheet" href="/markdown.css" />
9
10
  <title>mdts - Markdown file viewer</title>
10
11
  <script defer src="/bundle.js"></script></head>
@@ -5,21 +5,21 @@
5
5
  <stop offset="100%" stop-color="#1f43ab"/>
6
6
  </linearGradient>
7
7
  <style>
8
- .text {
8
+ .logo-text {
9
9
  font-family: 'Segoe UI', 'Arial', sans-serif;
10
10
  font-size: 42px;
11
11
  font-weight: 700;
12
12
  fill: url(#grad);
13
13
  letter-spacing: 2px;
14
14
  }
15
- .icon {
15
+ .logo-icon {
16
16
  fill: url(#grad);
17
17
  }
18
18
  </style>
19
19
  </defs>
20
20
 
21
21
  <!-- Icon (Abstract Folder Tree) -->
22
- <g class="icon" transform="translate(10, 20)">
22
+ <g class="logo-icon" transform="translate(10, 20)">
23
23
  <path d="M5 25 L15 45" stroke="url(#grad)" stroke-width="2"/>
24
24
  <path d="M25 25 L15 45" stroke="url(#grad)" stroke-width="2"/>
25
25
  <rect x="0" y="20" width="10" height="10" rx="2"/>
@@ -28,5 +28,5 @@
28
28
  </g>
29
29
 
30
30
  <!-- Logotype -->
31
- <text x="60" y="70" class="text">mdts</text>
31
+ <text x="60" y="70" class="logo-text">mdts</text>
32
32
  </svg>
@@ -4,8 +4,6 @@
4
4
  --markdown-code-background-color: #f4f5f7;
5
5
  --markdown-blockquote-color: rgba(0, 0, 0, .24);
6
6
  --markdown-link-color: #1976d2;
7
- --markdown-font-family: Roboto;
8
- --markdown-monospace-font-family: monospace;
9
7
  }
10
8
 
11
9
  [data-theme="dark"] {
@@ -16,7 +14,6 @@
16
14
  }
17
15
 
18
16
  .markdown-body {
19
- font-family: var(--markdown-font-family);
20
17
  h1 {
21
18
  margin: 48px 0 24px;
22
19
  padding-bottom: 16px;
@@ -105,20 +102,28 @@
105
102
  }
106
103
 
107
104
  pre {
108
- padding: 16px;
105
+ padding: 0;
109
106
  overflow: auto;
110
107
  font-size: 0.875rem;
111
- background-color: var(--markdown-pre-background-color);
112
- font-family: var(--markdown-monospace-font-family);
108
+ border-radius: 4px;
113
109
 
114
110
  code {
115
- padding: 0;
111
+ width: 100%;
112
+ margin: 0;
113
+ padding: 16px;
116
114
  font-size: 0.875rem;
115
+ line-height: 1.8;
117
116
  word-break: normal;
118
117
  white-space: pre;
119
118
  background: transparent;
120
119
  border: 0;
121
120
  }
121
+
122
+ .syntax-highlighter {
123
+ code {
124
+ padding: 0;
125
+ }
126
+ }
122
127
  }
123
128
 
124
129
  pre:has(.syntax-highlighter) {
@@ -131,9 +136,7 @@
131
136
  padding: .1em .6em;
132
137
  margin: 0;
133
138
  font-size: 0.8em;
134
- background-color: var(--markdown-code-background-color);
135
139
  border-radius: 2px;
136
- font-family: var(--markdown-monospace-font-family);
137
140
  }
138
141
 
139
142
  blockquote {
@@ -161,4 +164,9 @@
161
164
  text-decoration: none;
162
165
  }
163
166
  }
167
+
168
+ .katex {
169
+ position: relative;
170
+ font-size: 1.143rem;
171
+ }
164
172
  }
@@ -9,8 +9,10 @@ const path_1 = __importDefault(require("path"));
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const defaultConfig = {
11
11
  fontFamily: 'Roboto',
12
- fontFamilyMonospace: 'monospace',
12
+ fontFamilyMonospace: 'Roboto Mono',
13
13
  fontSize: 16,
14
+ theme: 'default',
15
+ syntaxHighlighterTheme: 'auto',
14
16
  };
15
17
  const configPath = path_1.default.join(os_1.default.homedir(), '.config', 'mdts', 'config.json');
16
18
  const getConfig = () => {
@@ -5,21 +5,21 @@
5
5
  <stop offset="100%" stop-color="#1f43ab"/>
6
6
  </linearGradient>
7
7
  <style>
8
- .text {
8
+ .logo-text {
9
9
  font-family: 'Segoe UI', 'Arial', sans-serif;
10
10
  font-size: 42px;
11
11
  font-weight: 700;
12
12
  fill: url(#grad);
13
13
  letter-spacing: 2px;
14
14
  }
15
- .icon {
15
+ .logo-icon {
16
16
  fill: url(#grad);
17
17
  }
18
18
  </style>
19
19
  </defs>
20
20
 
21
21
  <!-- Icon (Abstract Folder Tree) -->
22
- <g class="icon" transform="translate(10, 20)">
22
+ <g class="logo-icon" transform="translate(10, 20)">
23
23
  <path d="M5 25 L15 45" stroke="url(#grad)" stroke-width="2"/>
24
24
  <path d="M25 25 L15 45" stroke="url(#grad)" stroke-width="2"/>
25
25
  <rect x="0" y="20" width="10" height="10" rx="2"/>
@@ -28,5 +28,5 @@
28
28
  </g>
29
29
 
30
30
  <!-- Logotype -->
31
- <text x="60" y="70" class="text">mdts</text>
31
+ <text x="60" y="70" class="logo-text">mdts</text>
32
32
  </svg>
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
35
44
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
46
  };
@@ -45,7 +54,7 @@ const logger_1 = require("../../utils/logger");
45
54
  const md = new markdown_it_1.default();
46
55
  const outlineRouter = (directory) => {
47
56
  const router = (0, express_1.Router)();
48
- router.get('/', (req, res) => {
57
+ router.get('/', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
49
58
  const filePath = req.query.filePath;
50
59
  if (!filePath) {
51
60
  return res.status(400).send('filePath query parameter is required.');
@@ -54,29 +63,24 @@ const outlineRouter = (directory) => {
54
63
  const absolutePath = filePath === 'mdts-welcome-markdown.md'
55
64
  ? path_1.default.join(__dirname, '../public/welcome.md')
56
65
  : path_1.default.join(directory, filePath);
57
- const outline = getMarkdownOutline(absolutePath);
66
+ const outline = yield getMarkdownOutline(absolutePath);
58
67
  res.json(outline);
59
68
  }
60
69
  catch (error) {
61
70
  logger_1.logger.error(`Error getting outline for ${filePath}:`, error);
62
71
  res.status(500).send('Error getting outline.');
63
72
  }
64
- });
73
+ }));
65
74
  return router;
66
75
  };
67
76
  exports.outlineRouter = outlineRouter;
68
- const slugify = (text) => {
69
- return text
70
- .toLowerCase()
71
- .replace(/[^\p{L}\p{N}\s-]/gu, '') // Remove non-alphanumeric, non-space, non-hyphen characters. \p{L} for unicode letters, \p{N} for unicode numbers. 'u' flag for unicode.
72
- .replace(/\s+/g, '-') // Replace spaces with single hyphen
73
- .replace(/-+/g, '-') // Replace multiple hyphens with single hyphen
74
- .replace(/^-+|-+$/g, ''); // Trim leading/trailing hyphens
75
- };
76
- const getMarkdownOutline = (filePath) => {
77
+ const getMarkdownOutline = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
77
78
  if (!fs.existsSync(filePath)) {
78
79
  return [];
79
80
  }
81
+ const slugger = yield import('github-slugger')
82
+ .then(module => module.default)
83
+ .then(GithubSlugger => new GithubSlugger());
80
84
  const fileContent = fs.readFileSync(filePath, 'utf-8');
81
85
  const tokens = md.parse(fileContent, {});
82
86
  const outline = [];
@@ -86,10 +90,10 @@ const getMarkdownOutline = (filePath) => {
86
90
  const nextToken = tokens[tokens.indexOf(token) + 1];
87
91
  if (nextToken && nextToken.type === 'inline') {
88
92
  const content = nextToken.content;
89
- const id = slugify(content);
93
+ const id = slugger.slug(content);
90
94
  outline.push({ level, content, id });
91
95
  }
92
96
  }
93
97
  }
94
98
  return outline;
95
- };
99
+ });
@@ -12,7 +12,7 @@ class Logger {
12
12
  if (this.silent) {
13
13
  return;
14
14
  }
15
- /* eslint-disable max-len */
15
+ /* eslint-disable @stylistic/max-len */
16
16
  console.log(`
17
17
                  _ _       
18
18
    _ __ ___   __| | |_ ___ 
@@ -21,7 +21,7 @@ class Logger {
21
21
   |_| |_| |_|\\__,_|\\__|___/
22
22
                            
23
23
  `);
24
- /* eslint-enable max-len */
24
+ /* eslint-enable @stylistic/max-len */
25
25
  }
26
26
  log(tag, message, ...args) {
27
27
  if (this.silent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdts",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "A markdown preview server.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,32 +41,39 @@
41
41
  },
42
42
  "homepage": "https://mdts.unhappychoice.com",
43
43
  "devDependencies": {
44
+ "@stylistic/eslint-plugin": "^5.2.3",
44
45
  "@types/commander": "^2.12.0",
45
46
  "@types/express": "^5.0.3",
46
47
  "@types/jest": "^30.0.0",
47
48
  "@types/markdown-it": "^14.1.2",
48
49
  "@types/supertest": "^6.0.3",
49
50
  "@types/ws": "^8.18.1",
50
- "@typescript-eslint/eslint-plugin": "^8.37.0",
51
- "@typescript-eslint/parser": "^8.37.0",
51
+ "@typescript-eslint/eslint-plugin": "^8.39.0",
52
+ "@typescript-eslint/parser": "^8.39.0",
52
53
  "axios": "^1.10.0",
53
- "eslint": "^8.0.0",
54
+ "eslint": "^9.32.0",
54
55
  "jest": "^30.0.4",
55
56
  "jest-runner-eslint": "^2.3.0",
56
57
  "supertest": "^7.1.3",
57
58
  "ts-jest": "^29.4.0",
58
59
  "ts-node": "^10.9.2",
59
60
  "typescript": "^5.8.3",
60
- "typescript-eslint": "^8.37.0"
61
+ "typescript-eslint": "^8.39.0"
61
62
  },
62
63
  "dependencies": {
63
64
  "chalk": "^5.4.1",
64
65
  "chokidar": "^4.0.3",
65
66
  "commander": "^14.0.0",
66
67
  "express": "^5.1.0",
68
+ "github-slugger": "^2.0.0",
67
69
  "markdown-it": "^14.1.0",
68
70
  "open": "^10.2.0",
69
71
  "simple-git": "^3.28.0",
70
72
  "ws": "^8.18.3"
73
+ },
74
+ "overrides": {
75
+ "jest-runner-eslint": {
76
+ "eslint": "^9.32.0"
77
+ }
71
78
  }
72
79
  }