memd-cli 1.0.4 → 1.1.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 (3) hide show
  1. package/README.md +24 -3
  2. package/main.js +7 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,15 +2,36 @@
2
2
 
3
3
  > View mermaid-ed markdown in terminal
4
4
 
5
- ## Install/Update
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  npm install -g memd-cli
9
9
  ```
10
10
 
11
-
12
11
  ## Usage
13
12
 
13
+
14
+ ```
15
+ Usage: memd [options] [files...]
16
+
17
+ Render markdown with mermaid diagrams to terminal output
18
+
19
+ Arguments:
20
+ files markdown file(s) to render
21
+
22
+ Options:
23
+ -v, --version output the version number
24
+ --no-pager disable pager (less)
25
+ --no-color disable colored output
26
+ --no-highlight disable syntax highlighting
27
+ --width <number> terminal width override
28
+ --ascii use pure ASCII mode for diagrams (default: unicode)
29
+ -h, --help display help for command
30
+ ```
31
+
32
+
33
+ ## Example
34
+
14
35
  ### File input
15
36
 
16
37
  ```
@@ -289,7 +310,7 @@ npm remove -g memd-cli
289
310
 
290
311
  ```bash
291
312
  # tag
292
- npm install -g git+https://github.com/ktrysmt/memd.git#v1.0.4
313
+ npm install -g git+https://github.com/ktrysmt/memd.git#v1.1.0
293
314
  # branch
294
315
  npm install -g git+https://github.com/ktrysmt/memd.git#master
295
316
  npm install -g git+https://github.com/ktrysmt/memd.git#feature
package/main.js CHANGED
@@ -43,6 +43,9 @@ function convertMermaidToAscii(markdown, options = {}) {
43
43
  if (options.width) {
44
44
  mermaidOptions.maxWidth = options.width;
45
45
  }
46
+ if (options.ascii) {
47
+ mermaidOptions.useAscii = true;
48
+ }
46
49
  const asciiArt = renderMermaidAscii(code.trim(), mermaidOptions);
47
50
  return '```text\n' + asciiArt + '\n```';
48
51
  } catch (error) {
@@ -126,13 +129,14 @@ function spawnPager(text, options) {
126
129
  async function main() {
127
130
  program
128
131
  .name('memd')
129
- .version(packageJson.version)
132
+ .version(packageJson.version, '-v, --version', 'output the version number')
130
133
  .description('Render markdown with mermaid diagrams to terminal output')
131
134
  .argument('[files...]', 'markdown file(s) to render')
132
135
  .option('--no-pager', 'disable pager (less)')
133
136
  .option('--no-color', 'disable colored output')
134
137
  .option('--no-highlight', 'disable syntax highlighting')
135
- .option('--width <number>', 'terminal width override', Number, process.stdout.columns ?? 80)
138
+ .option('--width <number>', 'terminal width override', Number)
139
+ .option('--ascii', 'use pure ASCII mode for diagrams (default: unicode)')
136
140
  .action(async (files, options) => {
137
141
  // Check if color should be disabled (--no-color or NO_COLOR env var)
138
142
  const useColor = options.color !== false && !process.env.NO_COLOR;
@@ -145,7 +149,7 @@ async function main() {
145
149
 
146
150
  marked.use(markedTerminal({
147
151
  reflowText: true,
148
- width: options.width,
152
+ width: options.width ?? process.stdout.columns ?? 80,
149
153
  }, highlightOptions));
150
154
 
151
155
  // Override link renderer to avoid OSC 8 escape sequences (fixes tmux display issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memd-cli",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "bin": {