md-review 0.0.4 → 0.0.6
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 +17 -6
- package/bin/md-review.js +26 -38
- package/dist/assets/index-BZ_-Uaqe.js +87 -0
- package/dist/assets/index-B_-fb83n.css +19 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/server/index.js +24 -6
- package/dist/assets/index-BSdkfsKj.css +0 -10
- package/dist/assets/index-CZ7h92Sm.js +0 -87
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# md-review
|
|
2
2
|
|
|
3
|
-
English | [日本語](./README-ja.md)
|
|
3
|
+
English | [日本語](./README-ja.md) | [简体中文](./README-zh.md)
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -12,6 +12,9 @@ Comments can be copied and used as feedback for AI agents.
|
|
|
12
12
|
- Display Markdown in its original format
|
|
13
13
|
- Add comments to specific lines
|
|
14
14
|
- Select files from tree view
|
|
15
|
+
- Dark mode support (follows system preferences)
|
|
16
|
+
- Resizable and collapsible sidebars
|
|
17
|
+
- Click line numbers in comments to jump to corresponding content
|
|
15
18
|
|
|
16
19
|
## Install
|
|
17
20
|
|
|
@@ -22,17 +25,25 @@ npm install -g md-review
|
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
24
27
|
```sh
|
|
25
|
-
md-review
|
|
28
|
+
md-review [options] # Browse all markdown files in current directory
|
|
29
|
+
md-review <file> [options] # Preview a specific markdown file
|
|
26
30
|
```
|
|
27
31
|
|
|
28
32
|
### Options
|
|
29
33
|
|
|
30
34
|
```sh
|
|
31
|
-
-p, --port <port>
|
|
32
|
-
--api-port <port> API server port (default: 3030)
|
|
35
|
+
-p, --port <port> Server port (default: 3030)
|
|
33
36
|
--no-open Do not open browser automatically
|
|
34
|
-
-h, --help Show help
|
|
35
|
-
-v, --version Show version
|
|
37
|
+
-h, --help Show this help message
|
|
38
|
+
-v, --version Show version number
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Examples
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
md-review # Browse all markdown files in current directory
|
|
45
|
+
md-review README.md # Preview README.md
|
|
46
|
+
md-review docs/guide.md --port 8080
|
|
36
47
|
```
|
|
37
48
|
|
|
38
49
|
## License
|
package/bin/md-review.js
CHANGED
|
@@ -37,8 +37,7 @@ const args = mri(process.argv.slice(2), {
|
|
|
37
37
|
v: 'version'
|
|
38
38
|
},
|
|
39
39
|
default: {
|
|
40
|
-
port: '
|
|
41
|
-
'api-port': '3030',
|
|
40
|
+
port: '3030',
|
|
42
41
|
open: true
|
|
43
42
|
},
|
|
44
43
|
boolean: ['help', 'version', 'open']
|
|
@@ -54,8 +53,7 @@ Usage:
|
|
|
54
53
|
md-review <file> [options] Preview a specific markdown file (.md or .markdown)
|
|
55
54
|
|
|
56
55
|
Options:
|
|
57
|
-
-p, --port <port>
|
|
58
|
-
--api-port <port> API server port (default: 3030)
|
|
56
|
+
-p, --port <port> Server port (default: 3030)
|
|
59
57
|
--no-open Do not open browser automatically
|
|
60
58
|
-h, --help Show this help message
|
|
61
59
|
-v, --version Show version number
|
|
@@ -76,12 +74,10 @@ if (args.version) {
|
|
|
76
74
|
|
|
77
75
|
const file = args._[0];
|
|
78
76
|
const port = validatePort(args.port, 'port');
|
|
79
|
-
const apiPort = validatePort(args['api-port'], 'api-port');
|
|
80
77
|
const shouldOpen = args.open;
|
|
81
78
|
|
|
82
79
|
// Set environment variables
|
|
83
|
-
process.env.API_PORT =
|
|
84
|
-
process.env.VITE_PORT = port;
|
|
80
|
+
process.env.API_PORT = port;
|
|
85
81
|
|
|
86
82
|
// If file is specified, validate it
|
|
87
83
|
if (file) {
|
|
@@ -106,66 +102,58 @@ if (file) {
|
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
console.log('Starting md-review...');
|
|
109
|
-
console.log(`
|
|
110
|
-
console.log(` Vite Port: ${port}`);
|
|
105
|
+
console.log(` Port: ${port}`);
|
|
111
106
|
|
|
112
|
-
// Start
|
|
113
|
-
const
|
|
107
|
+
// Start server
|
|
108
|
+
const serverProcess = spawn('node', ['server/index.js'], {
|
|
114
109
|
cwd: packageRoot,
|
|
115
110
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
116
111
|
env: process.env
|
|
117
112
|
});
|
|
118
113
|
|
|
119
|
-
let viteProcess = null;
|
|
120
114
|
let serverReady = false;
|
|
115
|
+
let actualPort = port;
|
|
121
116
|
|
|
122
|
-
// Wait for
|
|
123
|
-
|
|
117
|
+
// Wait for server to be ready before opening browser
|
|
118
|
+
serverProcess.stdout.on('data', async (data) => {
|
|
124
119
|
process.stdout.write(data);
|
|
125
120
|
const output = data.toString();
|
|
126
121
|
|
|
122
|
+
// Extract actual port from "API Server running on http://localhost:XXXX"
|
|
123
|
+
const portMatch = output.match(/API Server running on http:\/\/localhost:(\d+)/);
|
|
124
|
+
if (portMatch) {
|
|
125
|
+
actualPort = parseInt(portMatch[1], 10);
|
|
126
|
+
}
|
|
127
|
+
|
|
127
128
|
if (!serverReady && output.includes(SERVER_READY_MESSAGE)) {
|
|
128
129
|
serverReady = true;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
'--port', port,
|
|
135
|
-
...(shouldOpen ? ['--open'] : [])
|
|
136
|
-
], {
|
|
137
|
-
cwd: packageRoot,
|
|
138
|
-
stdio: 'inherit',
|
|
139
|
-
env: process.env
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
viteProcess.on('error', (err) => {
|
|
143
|
-
console.error('Vite server error:', err.message);
|
|
144
|
-
});
|
|
130
|
+
|
|
131
|
+
if (shouldOpen) {
|
|
132
|
+
const openModule = await import('open');
|
|
133
|
+
openModule.default(`http://localhost:${actualPort}`);
|
|
134
|
+
}
|
|
145
135
|
}
|
|
146
136
|
});
|
|
147
137
|
|
|
148
138
|
// Handle graceful shutdown
|
|
149
139
|
const shutdown = () => {
|
|
150
140
|
console.log('\nShutting down...');
|
|
151
|
-
|
|
152
|
-
viteProcess?.kill('SIGINT');
|
|
141
|
+
serverProcess.kill('SIGINT');
|
|
153
142
|
process.exit(0);
|
|
154
143
|
};
|
|
155
144
|
|
|
156
145
|
process.on('SIGINT', shutdown);
|
|
157
146
|
process.on('SIGTERM', shutdown);
|
|
158
147
|
|
|
159
|
-
// Handle
|
|
160
|
-
|
|
148
|
+
// Handle server exit
|
|
149
|
+
serverProcess.on('exit', (code) => {
|
|
161
150
|
if (code !== 0 && code !== null) {
|
|
162
|
-
console.error(`
|
|
151
|
+
console.error(`Server exited with code ${code}`);
|
|
163
152
|
}
|
|
164
|
-
viteProcess?.kill('SIGINT');
|
|
165
153
|
process.exit(code || 0);
|
|
166
154
|
});
|
|
167
155
|
|
|
168
|
-
|
|
169
|
-
console.error('Failed to start
|
|
156
|
+
serverProcess.on('error', (err) => {
|
|
157
|
+
console.error('Failed to start server:', err.message);
|
|
170
158
|
process.exit(1);
|
|
171
159
|
});
|