memd-cli 3.0.0 → 3.0.1

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
@@ -11,8 +11,8 @@ npm install -g memd-cli
11
11
  ## Usage
12
12
 
13
13
 
14
- ```
15
- Usage: memd [options] [files...]
14
+ ```sh
15
+ Usage: memd [options] [command] [files...]
16
16
 
17
17
  Render markdown with mermaid diagrams
18
18
 
@@ -27,12 +27,13 @@ Options:
27
27
  --width <number> terminal width override
28
28
  --ascii use pure ASCII mode for diagrams (default: unicode)
29
29
  --html output as standalone HTML (mermaid diagrams rendered as inline SVG)
30
- --theme <name> color theme (default: "nord", env: MEMD_THEME)
31
- zinc-light, zinc-dark, tokyo-night, tokyo-night-storm,
32
- tokyo-night-light, catppuccin-mocha, catppuccin-latte,
33
- nord, nord-light, dracula, github-light, github-dark,
34
- solarized-light, solarized-dark, one-dark
30
+ --theme <name> color theme (env: MEMD_THEME)
31
+ nord, dracula, one-dark, github-dark, github-light, solarized-dark, solarized-light, catppuccin-mocha, catppuccin-latte, tokyo-night, tokyo-night-storm, tokyo-night-light, nord-light,
32
+ zinc-dark, zinc-light (default: "catppuccin-mocha")
35
33
  -h, --help display help for command
34
+
35
+ Commands:
36
+ serve [options] Start HTTP server to serve .md files as HTML
36
37
  ```
37
38
 
38
39
 
@@ -293,45 +294,6 @@ This is regular text between mermaid diagrams.
293
294
 
294
295
  ```
295
296
 
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
-
335
297
  ### HTML output
336
298
 
337
299
  HTML is written to stdout. Use shell redirection to save to a file.
@@ -355,29 +317,51 @@ $ echo '# Hello\n\n```mermaid\nflowchart LR\n A --> B\n```' | memd
355
317
  └───┘ └───┘
356
318
  ```
357
319
 
358
- ## Uninstall
320
+ ### Serve
359
321
 
360
- ```bash
361
- npm remove -g memd-cli
362
- ```
322
+ Start a local HTTP server that renders `.md` files as HTML on the fly.
363
323
 
364
- ## Development
324
+ ```sh
325
+ $ memd serve --help
326
+ Usage: memd serve [options]
365
327
 
366
- ```bash
367
- node main.js test/test1.md
328
+ Start HTTP server to serve .md files as HTML
329
+
330
+ Options:
331
+ -d, --dir <path> directory to serve (default: ".")
332
+ -p, --port <number> port number (0-65535) (default: 8888)
333
+ --host <string> host to bind (default: "127.0.0.1")
334
+ --workers <number> number of render workers (default: min(cpus-1, 4))
335
+ --watch watch for file changes and live-reload
336
+ --theme <name> color theme (env: MEMD_THEME)
337
+ nord, dracula, one-dark, github-dark, github-light, solarized-dark,
338
+ solarized-light, catppuccin-mocha, catppuccin-latte, tokyo-night,
339
+ tokyo-night-storm, tokyo-night-light, nord-light, zinc-dark, zinc-light (default:
340
+ "catppuccin-mocha")
341
+ -h, --help display help for command
368
342
  ```
369
343
 
370
- ## Use specific version
344
+ Example:
371
345
 
372
- ```bash
373
- # tag
374
- npm install -g git+https://github.com/ktrysmt/memd.git#v2.0.0
375
- # branch
376
- npm install -g git+https://github.com/ktrysmt/memd.git#master
377
- npm install -g git+https://github.com/ktrysmt/memd.git#feature
378
- # hash
379
- npm install -g git+https://github.com/ktrysmt/memd.git#a52a596
380
346
  ```
347
+ $ memd serve
348
+ memd serve
349
+ Directory: /home/ubuntu/docs
350
+ Theme: nord
351
+ URL: http://localhost:8888/
352
+
353
+ $ memd serve --dir ./docs --port 3000 --theme dracula
354
+ $ memd serve --workers 2
355
+ $ memd serve --watch
356
+ ```
357
+
358
+ Note:
359
+
360
+ * Specifying `--host 0.0.0.0` binds the server to all network interfaces. Since there is no authentication mechanism, `.md` files in the directory will be accessible over the network. Use only within trusted networks.
361
+ * The serve command has a small timing gap (TOCTOU) between path validation and file reading. Use on trusted filesystems only.
362
+ * Serve serves `.md` files, images (png, jpg, gif, svg, webp, ico, avif), and CSS. JavaScript and other file types are not served.
363
+ * Each worker loads the Mermaid rendering library in an independent V8 isolate. Each worker consumes approximately 80-120 MB of memory. The default is `min(num_CPUs-1, 4)` workers. In memory-constrained environments, specify `--workers 1`. Recommended memory: 512 MB + (number of workers x 120 MB).
364
+
381
365
 
382
366
  ## Author
383
367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memd-cli",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "bin": {
package/test/memd.test.js CHANGED
@@ -31,7 +31,7 @@ function runSync(args) {
31
31
  describe('memd CLI', () => {
32
32
  it('--version', async () => {
33
33
  const output = await run(['-v'])
34
- expect(output).toContain('3.0.0')
34
+ expect(output).toContain('3.0.1')
35
35
  })
36
36
 
37
37
  it('--help', async () => {
@@ -1,20 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(echo:*)",
5
- "Bash(FORCE_COLOR=1 echo:*)",
6
- "Bash(script:*)",
7
- "Bash(FORCE_COLOR=1 node:*)",
8
- "Bash(node -e \"import\\('beautiful-mermaid/src/ascii/ansi.ts'\\).then\\(m=>console.log\\(Object.keys\\(m\\)\\)\\).catch\\(e=>console.error\\('ERROR:',e.message\\)\\)\" 2>&1 | head -5)",
9
- "Bash(node main.js test/test-highlight.md --no-pager --theme catppuccin-mocha 2>&1 | head -3 | xxd | head -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
- "Bash(FORCE_COLOR=1 node main.js test/test-highlight.md --no-pager --theme zinc-dark 2>&1 | head -3 | xxd | head -5)",
12
- "mcp__grep-github__searchGitHub",
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:*)"
18
- ]
19
- }
20
- }