memd-cli 2.0.1 → 2.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.
@@ -9,7 +9,8 @@
9
9
  "Bash(node main.js test/test-highlight.md --no-pager --theme catppuccin-mocha 2>&1 | head -3 | xxd | head -10)",
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
- "mcp__grep-github__searchGitHub"
12
+ "mcp__grep-github__searchGitHub",
13
+ "Bash(npx npm-check-updates:*)"
13
14
  ]
14
15
  }
15
16
  }
package/README.md CHANGED
@@ -27,7 +27,7 @@ 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")
30
+ --theme <name> color theme (default: "nord", env: MEMD_THEME)
31
31
  zinc-light, zinc-dark, tokyo-night, tokyo-night-storm,
32
32
  tokyo-night-light, catppuccin-mocha, catppuccin-latte,
33
33
  nord, nord-light, dracula, github-light, github-dark,
package/main.js CHANGED
@@ -372,7 +372,7 @@ async function main() {
372
372
  .option('--width <number>', 'terminal width override', Number)
373
373
  .option('--ascii', 'use pure ASCII mode for diagrams (default: unicode)')
374
374
  .option('--html', 'output as standalone HTML (mermaid diagrams rendered as inline SVG)')
375
- .option('--theme <name>', `color theme\n${THEME_NAMES.join(', ')}`, 'nord')
375
+ .option('--theme <name>', `color theme (env: MEMD_THEME)\n${THEME_NAMES.join(', ')}`, process.env.MEMD_THEME || 'nord')
376
376
  .action(async (files, options) => {
377
377
  // 1. Validate theme via THEME_MAP (unified for both paths)
378
378
  if (!(options.theme in THEME_MAP)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memd-cli",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -10,10 +10,10 @@
10
10
  "test": "vitest run"
11
11
  },
12
12
  "dependencies": {
13
- "beautiful-mermaid": "^1.1.2",
13
+ "beautiful-mermaid": "^1.1.3",
14
14
  "chalk": "^5.6.2",
15
15
  "commander": "^14.0.3",
16
- "marked": "^17.0.3",
16
+ "marked": "^17.0.4",
17
17
  "marked-terminal": "^7.3.0",
18
18
  "shiki": "^4.0.2"
19
19
  },
@@ -25,7 +25,7 @@
25
25
  "node": ">=20"
26
26
  },
27
27
  "license": "MIT",
28
- "packageManager": "pnpm@10.15.1",
28
+ "packageManager": "pnpm@10.32.1",
29
29
  "devDependencies": {
30
30
  "tuistory": "^0.0.16",
31
31
  "vitest": "^4.0.18"
package/test/memd.test.js CHANGED
@@ -27,7 +27,7 @@ function runSync(args) {
27
27
  describe('memd CLI', () => {
28
28
  it('--version', async () => {
29
29
  const output = await run(['-v'])
30
- expect(output).toContain('2.0.0')
30
+ expect(output).toContain('2.1.0')
31
31
  })
32
32
 
33
33
  it('--help', async () => {
@@ -279,6 +279,37 @@ describe('memd CLI', () => {
279
279
  expect(output).toContain('Hello')
280
280
  expect(output).toContain('More text.')
281
281
  })
282
+
283
+ it('MEMD_THEME env sets default theme (HTML path)', () => {
284
+ const output = execSync(`node ${MAIN} --html test/test1.md`, {
285
+ encoding: 'utf-8',
286
+ timeout: 15000,
287
+ env: { ...process.env, MEMD_THEME: 'dracula' },
288
+ })
289
+ expect(output).toContain('#282a36') // dracula bg
290
+ expect(output).toContain('#f8f8f2') // dracula fg
291
+ })
292
+
293
+ it('--theme flag overrides MEMD_THEME env', () => {
294
+ const output = execSync(`node ${MAIN} --html --theme tokyo-night test/test1.md`, {
295
+ encoding: 'utf-8',
296
+ timeout: 15000,
297
+ env: { ...process.env, MEMD_THEME: 'dracula' },
298
+ })
299
+ expect(output).toContain('#1a1b26') // tokyo-night bg
300
+ expect(output).not.toContain('#282a36') // not dracula bg
301
+ })
302
+
303
+ it('invalid MEMD_THEME env exits with error', () => {
304
+ expect(() => {
305
+ execSync(`node ${MAIN} --html test/test1.md`, {
306
+ encoding: 'utf-8',
307
+ timeout: 15000,
308
+ stdio: 'pipe',
309
+ env: { ...process.env, MEMD_THEME: 'nonexistent' },
310
+ })
311
+ }).toThrow()
312
+ })
282
313
  })
283
314
 
284
315
  // chalk.level = 0 + Shiki: verify no ANSI codes for all themes