md-review 0.0.6 → 0.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.
package/README.md CHANGED
@@ -11,10 +11,12 @@ Comments can be copied and used as feedback for AI agents.
11
11
 
12
12
  - Display Markdown in its original format
13
13
  - Add comments to specific lines
14
+ - Edit existing comments
14
15
  - Select files from tree view
15
16
  - Dark mode support (follows system preferences)
16
17
  - Resizable and collapsible sidebars
17
18
  - Click line numbers in comments to jump to corresponding content
19
+ - Hot reload when markdown files change
18
20
 
19
21
  ## Install
20
22
 
@@ -27,6 +29,7 @@ npm install -g md-review
27
29
  ```sh
28
30
  md-review [options] # Browse all markdown files in current directory
29
31
  md-review <file> [options] # Preview a specific markdown file
32
+ md-review <directory> [options] # Browse markdown files in a specific directory
30
33
  ```
31
34
 
32
35
  ### Options
@@ -42,10 +45,43 @@ md-review <file> [options] # Preview a specific markdown file
42
45
 
43
46
  ```sh
44
47
  md-review # Browse all markdown files in current directory
48
+ md-review docs # Browse markdown files in docs directory
45
49
  md-review README.md # Preview README.md
46
50
  md-review docs/guide.md --port 8080
47
51
  ```
48
52
 
53
+ ## Comment Management
54
+
55
+ ### Adding Comments
56
+
57
+ 1. Select text in the markdown preview
58
+ 2. Click the "Comment" button that appears
59
+ 3. Type your comment and press `Cmd/Ctrl+Enter` or click "Submit"
60
+
61
+ ### Editing Comments
62
+
63
+ 1. Click the edit icon (pencil) on any existing comment
64
+ 2. Modify the text in the textarea
65
+ 3. Press `Cmd/Ctrl+Enter` or click "Save" to save changes
66
+ 4. Press `Escape` or click "Cancel" to discard changes
67
+
68
+ ### Keyboard Shortcuts
69
+
70
+ - `Cmd/Ctrl+Enter` - Submit/Save comment
71
+ - `Escape` - Cancel editing
72
+ - `Cmd+K` - Focus search bar (in directory mode)
73
+
74
+ ## Hot Module Replacement
75
+
76
+ md-review automatically watches for changes to markdown files:
77
+
78
+ - When you edit and save a markdown file, the preview updates automatically
79
+ - No manual browser refresh needed
80
+ - Works in both single file and directory browsing modes
81
+ - File watching uses efficient Server-Sent Events (SSE)
82
+
83
+ This makes it ideal for live editing workflows and quick iteration on documentation.
84
+
49
85
  ## License
50
86
 
51
87
  [MIT](./LICENSE)
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;