memd-cli 2.1.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
 
@@ -316,29 +317,51 @@ $ echo '# Hello\n\n```mermaid\nflowchart LR\n A --> B\n```' | memd
316
317
  └───┘ └───┘
317
318
  ```
318
319
 
319
- ## Uninstall
320
+ ### Serve
320
321
 
321
- ```bash
322
- npm remove -g memd-cli
323
- ```
322
+ Start a local HTTP server that renders `.md` files as HTML on the fly.
324
323
 
325
- ## Development
324
+ ```sh
325
+ $ memd serve --help
326
+ Usage: memd serve [options]
326
327
 
327
- ```bash
328
- 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
329
342
  ```
330
343
 
331
- ## Use specific version
344
+ Example:
332
345
 
333
- ```bash
334
- # tag
335
- npm install -g git+https://github.com/ktrysmt/memd.git#v2.0.0
336
- # branch
337
- npm install -g git+https://github.com/ktrysmt/memd.git#master
338
- npm install -g git+https://github.com/ktrysmt/memd.git#feature
339
- # hash
340
- npm install -g git+https://github.com/ktrysmt/memd.git#a52a596
341
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
+
342
365
 
343
366
  ## Author
344
367