md-review 0.0.7 → 1.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/README.md CHANGED
@@ -29,6 +29,7 @@ npm install -g md-review
29
29
  ```sh
30
30
  md-review [options] # Browse all markdown files in current directory
31
31
  md-review <file> [options] # Preview a specific markdown file
32
+ md-review <directory> [options] # Browse markdown files in a specific directory
32
33
  ```
33
34
 
34
35
  ### Options
@@ -44,6 +45,7 @@ md-review <file> [options] # Preview a specific markdown file
44
45
 
45
46
  ```sh
46
47
  md-review # Browse all markdown files in current directory
48
+ md-review docs # Browse markdown files in docs directory
47
49
  md-review README.md # Preview README.md
48
50
  md-review docs/guide.md --port 8080
49
51
  ```
@@ -51,17 +53,20 @@ md-review docs/guide.md --port 8080
51
53
  ## Comment Management
52
54
 
53
55
  ### Adding Comments
56
+
54
57
  1. Select text in the markdown preview
55
58
  2. Click the "Comment" button that appears
56
59
  3. Type your comment and press `Cmd/Ctrl+Enter` or click "Submit"
57
60
 
58
61
  ### Editing Comments
62
+
59
63
  1. Click the edit icon (pencil) on any existing comment
60
64
  2. Modify the text in the textarea
61
65
  3. Press `Cmd/Ctrl+Enter` or click "Save" to save changes
62
66
  4. Press `Escape` or click "Cancel" to discard changes
63
67
 
64
68
  ### Keyboard Shortcuts
69
+
65
70
  - `Cmd/Ctrl+Enter` - Submit/Save comment
66
71
  - `Escape` - Cancel editing
67
72
  - `Cmd+K` - Focus search bar (in directory mode)
package/bin/md-review.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { spawn } from 'child_process';
4
4
  import { resolve, dirname } from 'path';
5
- import { existsSync, readFileSync } from 'fs';
5
+ import { existsSync, readFileSync, statSync } from 'fs';
6
6
  import { fileURLToPath } from 'url';
7
7
  import mri from 'mri';
8
8
 
@@ -34,13 +34,13 @@ const args = mri(process.argv.slice(2), {
34
34
  alias: {
35
35
  p: 'port',
36
36
  h: 'help',
37
- v: 'version'
37
+ v: 'version',
38
38
  },
39
39
  default: {
40
40
  port: '3030',
41
- open: true
41
+ open: true,
42
42
  },
43
- boolean: ['help', 'version', 'open']
43
+ boolean: ['help', 'version', 'open'],
44
44
  });
45
45
 
46
46
  // Help message
@@ -51,6 +51,7 @@ md-review - Review and annotate Markdown files with comments
51
51
  Usage:
52
52
  md-review [options] Start in dev mode (browse all markdown files)
53
53
  md-review <file> [options] Preview a specific markdown file (.md or .markdown)
54
+ md-review <directory> [options] Browse markdown files in a specific directory
54
55
 
55
56
  Options:
56
57
  -p, --port <port> Server port (default: 3030)
@@ -60,6 +61,7 @@ Options:
60
61
 
61
62
  Examples:
62
63
  md-review Start dev mode in current directory
64
+ md-review docs Browse markdown files in docs directory
63
65
  md-review README.md Preview README.md
64
66
  md-review docs/guide.md --port 8080
65
67
  `);
@@ -88,13 +90,22 @@ if (file) {
88
90
  process.exit(1);
89
91
  }
90
92
 
91
- if (!isMarkdownFile(filePath)) {
92
- console.error(`Error: File must have .md or .markdown extension: ${filePath}`);
93
- process.exit(1);
94
- }
93
+ const stats = statSync(filePath);
94
+
95
+ if (stats.isDirectory()) {
96
+ // Dev mode with specified directory
97
+ process.env.BASE_DIR = filePath;
98
+ console.log(`Directory: ${filePath}`);
99
+ } else {
100
+ // File mode
101
+ if (!isMarkdownFile(filePath)) {
102
+ console.error(`Error: File must have .md or .markdown extension: ${filePath}`);
103
+ process.exit(1);
104
+ }
95
105
 
96
- process.env.MARKDOWN_FILE_PATH = filePath;
97
- console.log(`File: ${filePath}`);
106
+ process.env.MARKDOWN_FILE_PATH = filePath;
107
+ console.log(`File: ${filePath}`);
108
+ }
98
109
  } else {
99
110
  // Dev mode - browse all markdown files
100
111
  process.env.BASE_DIR = process.cwd();
@@ -108,7 +119,7 @@ console.log(` Port: ${port}`);
108
119
  const serverProcess = spawn('node', ['server/index.js'], {
109
120
  cwd: packageRoot,
110
121
  stdio: ['inherit', 'pipe', 'inherit'],
111
- env: process.env
122
+ env: process.env,
112
123
  });
113
124
 
114
125
  let serverReady = false;