memd-cli 2.1.0 → 3.0.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/.claude/settings.local.json +5 -1
- package/README.md +39 -0
- package/main.js +901 -96
- package/package.json +1 -1
- package/render-shared.js +95 -0
- package/render-utils.js +31 -0
- package/render-worker.js +13 -0
- package/test/memd.test.js +293 -3
- package/test/pixel.png +0 -0
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"Bash(FORCE_COLOR=1 node main.js test/test-highlight.md --no-pager --theme catppuccin-mocha 2>&1 | head -3 | xxd | head -5)",
|
|
11
11
|
"Bash(FORCE_COLOR=1 node main.js test/test-highlight.md --no-pager --theme zinc-dark 2>&1 | head -3 | xxd | head -5)",
|
|
12
12
|
"mcp__grep-github__searchGitHub",
|
|
13
|
-
"Bash(npx npm-check-updates:*)"
|
|
13
|
+
"Bash(npx npm-check-updates:*)",
|
|
14
|
+
"Bash(MEMD_THEME= pnpm test 2>&1 | tail -20)",
|
|
15
|
+
"Bash(MEMD_THEME= npx vitest run 2>&1)",
|
|
16
|
+
"Bash(node:*)",
|
|
17
|
+
"Bash(printf:*)"
|
|
14
18
|
]
|
|
15
19
|
}
|
|
16
20
|
}
|
package/README.md
CHANGED
|
@@ -293,6 +293,45 @@ This is regular text between mermaid diagrams.
|
|
|
293
293
|
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
+
### Serve
|
|
297
|
+
|
|
298
|
+
Start a local HTTP server that renders `.md` files as HTML on the fly.
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
$ memd serve
|
|
302
|
+
memd serve
|
|
303
|
+
Directory: /home/ubuntu/docs
|
|
304
|
+
Theme: nord
|
|
305
|
+
URL: http://localhost:8888/
|
|
306
|
+
|
|
307
|
+
$ memd serve --dir ./docs --port 3000 --theme dracula
|
|
308
|
+
$ memd serve --workers 2
|
|
309
|
+
$ memd serve --watch
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
Usage: memd serve [options]
|
|
314
|
+
|
|
315
|
+
Start HTTP server to serve .md files as HTML
|
|
316
|
+
|
|
317
|
+
Options:
|
|
318
|
+
-d, --dir <path> directory to serve (default: ".")
|
|
319
|
+
-p, --port <number> port number (0-65535) (default: 8888)
|
|
320
|
+
--host <string> host to bind (default: "127.0.0.1")
|
|
321
|
+
--workers <number> number of render workers (default: min(cpus-1, 4))
|
|
322
|
+
--watch watch for file changes and live-reload
|
|
323
|
+
--theme <name> color theme (env: MEMD_THEME) (default: "nord")
|
|
324
|
+
-h, --help display help for command
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
> **Note:** `--host 0.0.0.0` を指定するとネットワーク上の全インターフェースにバインドされます。認証機構はないため、ディレクトリ内の `.md` ファイルがネットワーク上から閲覧可能になります。信頼されたネットワーク内でのみ使用してください。
|
|
328
|
+
>
|
|
329
|
+
> serve コマンドはパス検証とファイル読み取りの間にわずかなタイミング差 (TOCTOU) があります。信頼されたファイルシステム上で使用してください。
|
|
330
|
+
>
|
|
331
|
+
> serve は `.md` ファイル、画像 (png, jpg, gif, svg, webp, ico, avif)、CSS を配信します。JavaScript やその他のファイルは配信されません。
|
|
332
|
+
>
|
|
333
|
+
> 各ワーカーは独立した V8 isolate で Mermaid レンダリングライブラリをロードします。ワーカー1つあたり約 80-120 MB のメモリを消費します。デフォルトは `min(CPU数-1, 4)` ワーカーです。メモリが限られた環境では `--workers 1` を指定してください。推奨メモリ: 512 MB + (ワーカー数 x 120 MB)。
|
|
334
|
+
|
|
296
335
|
### HTML output
|
|
297
336
|
|
|
298
337
|
HTML is written to stdout. Use shell redirection to save to a file.
|