docrev 0.6.2 → 0.6.4

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 (2) hide show
  1. package/README.md +204 -336
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,423 +1,291 @@
1
1
  # docrev
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/docrev)](https://www.npmjs.com/package/docrev)
4
- [![CI](https://github.com/gcol33/docrev/actions/workflows/ci.yml/badge.svg)](https://github.com/gcol33/docrev/actions/workflows/ci.yml)
5
- [![Node.js](https://img.shields.io/node/v/docrev)](https://nodejs.org/)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
4
 
8
- CLI tool for Word Markdown round-trips. Handle reviewer feedback on academic papers: import track changes, review interactively, manage comments, validate DOIs, and build to PDF/DOCX/LaTeX.
5
+ **Write your papers in plain text. Generate Word documents when you need them.**
9
6
 
10
- ## Install
7
+ ## The Problem
11
8
 
12
- ```bash
13
- npm install -g docrev
14
- ```
9
+ You're writing a scientific paper. Your supervisor reviews it in Word, adding comments and track changes. You address the feedback, send it back. Another round of reviews. Then journal submission. Then reviewer comments. More Word documents flying back and forth.
15
10
 
16
- The `rev` command is now available globally.
11
+ Sound familiar?
17
12
 
18
- ### Prerequisites
13
+ - Word files get corrupted
14
+ - "Which version is the latest?" confusion
15
+ - Track changes become unreadable after multiple rounds
16
+ - Equations break when copy-pasting
17
+ - Figures get embedded at wrong resolutions
18
+ - Collaborating means emailing files back and forth
19
19
 
20
- - **Node.js 18+** - [Download](https://nodejs.org/)
21
- - **Pandoc** - For building PDF/DOCX ([pandoc.org](https://pandoc.org/installing.html))
22
- - **pandoc-crossref** - For figure/table refs (optional, [install](https://github.com/lierdakil/pandoc-crossref/releases))
20
+ ## The Solution
23
21
 
24
- ```bash
25
- # macOS
26
- brew install pandoc pandoc-crossref
22
+ **docrev** lets you write in plain text (Markdown) and generate Word/PDF whenever you need to share. Your collaborators keep using Word — they don't need to change anything. You get:
27
23
 
28
- # Ubuntu/Debian
29
- sudo apt install pandoc
24
+ - **Version control** — See exactly what changed, when, and why
25
+ - **No corruption** — Plain text files never break
26
+ - **Equations that work** — Write LaTeX, get perfect equations in Word
27
+ - **Figures stay separate** — Reference images, don't embed them
28
+ - **Automated formatting** — Citations, cross-references, all handled
30
29
 
31
- # Windows
32
- winget install JohnMacFarlane.Pandoc
33
- ```
30
+ ## How It Works
34
31
 
35
- Verify installation:
36
- ```bash
37
- rev --version
38
- rev install # Check for missing dependencies
39
32
  ```
40
-
41
- ### Shell Completions (Optional)
42
-
43
- Enable tab completion for `rev` commands:
44
-
45
- ```bash
46
- # Bash - add to ~/.bashrc
47
- eval "$(rev completions bash)"
48
-
49
- # Zsh - add to ~/.zshrc
50
- eval "$(rev completions zsh)"
33
+ Your text files ───► docrev ───► Word/PDF for collaborators
34
+ │ │
35
+ │ ▼
36
+ │ They add comments
37
+ │ │
38
+ │ ▼
39
+ └────────────── docrev ◄──── They send it back
40
+ (imports their feedback)
51
41
  ```
52
42
 
53
- ## Features
43
+ You always work in plain text. Word is just the delivery format.
54
44
 
55
- - **Integrated build system** - Combine sections → paper.md → PDF, DOCX, or LaTeX
56
- - **Import from Word** - Diff Word docs against your Markdown, generating CriticMarkup annotations
57
- - **Section-aware import** - Import directly to modular section files (intro.md, methods.md, etc.)
58
- - **Interactive review** - Accept/reject track changes with a TUI
59
- - **Comment management** - List, filter, resolve, and reply to reviewer comments
60
- - **Response letter generation** - Auto-generate point-by-point response from comments
61
- - **DOI validation** - Check and find DOIs via Crossref/DataCite APIs
62
- - **Cross-reference conversion** - Auto-convert "Figures 1-3" to `@fig:label` syntax (handles complex patterns)
63
- - **Equation extraction** - Extract LaTeX equations from Word documents (OMML → LaTeX)
64
- - **Citation validation** - Check citations against bibliography
45
+ ---
65
46
 
66
47
  ## Quick Start
67
48
 
68
- ### Start from Word Document
49
+ ### Install
69
50
 
70
51
  ```bash
71
- # Import existing Word doc → creates section files + rev.yaml
72
- rev import manuscript.docx
73
-
74
- # Import to specific directory
75
- rev import manuscript.docx -o my-paper/
76
-
77
- # Preview without creating files
78
- rev import manuscript.docx --dry-run
52
+ npm install -g docrev
53
+ brew install pandoc # Required for Word/PDF generation
79
54
  ```
80
55
 
81
- ### New Project from Template
56
+ ### Start a New Paper
82
57
 
83
58
  ```bash
84
- # Create a new paper project
85
59
  rev new my-paper
60
+ cd my-paper
61
+ ```
86
62
 
87
- # or with a specific template
88
- rev new my-thesis --template thesis
89
-
90
- # List available templates
91
- rev new --list
63
+ This creates:
64
+ ```
65
+ my-paper/
66
+ ├── introduction.md ← Write your intro here
67
+ ├── methods.md ← Your methods
68
+ ├── results.md ← Your results
69
+ ├── discussion.md ← Your discussion
70
+ ├── references.bib ← Your citations
71
+ └── rev.yaml ← Paper title, authors
92
72
  ```
93
73
 
94
- ### Build Workflow
74
+ ### Or Import from Existing Word Document
95
75
 
96
76
  ```bash
97
- cd my-paper
77
+ rev import my-manuscript.docx
78
+ ```
98
79
 
99
- # Edit your sections
100
- # introduction.md, methods.md, results.md, discussion.md
80
+ docrev extracts:
81
+ - Text Markdown files
82
+ - Comments → Preserved with author names
83
+ - Equations → Converted to LaTeX
84
+ - Images → Saved to figures/
101
85
 
102
- # Build PDF and Word
103
- rev build
86
+ ---
104
87
 
105
- # Build specific format
106
- rev build pdf
107
- rev build docx
108
- rev build tex
109
- rev build all # PDF + DOCX + TEX
110
- ```
88
+ ## Writing in Markdown
111
89
 
112
- ### Review Workflow
90
+ Markdown is just text with simple formatting. If you can write an email, you can write Markdown.
113
91
 
114
- ```bash
115
- # Import reviewer's Word doc to section files
116
- rev sections reviewed.docx
92
+ ### Basic Formatting
117
93
 
118
- # Review track changes interactively
119
- rev review methods.md
94
+ ```markdown
95
+ # This is a Heading
120
96
 
121
- # See remaining comments
122
- rev comments methods.md
97
+ This is a paragraph. **Bold text** and *italic text*.
123
98
 
124
- # Rebuild
125
- rev build docx
99
+ - Bullet point
100
+ - Another bullet
101
+
102
+ 1. Numbered list
103
+ 2. Second item
126
104
  ```
127
105
 
128
- ## Commands
129
-
130
- ### Build & Create
131
-
132
- | Command | Description |
133
- |---------|-------------|
134
- | `rev build [formats...]` | Build PDF/DOCX/TEX from sections |
135
- | `rev build --toc` | Build with table of contents |
136
- | `rev build --show-changes` | Export DOCX with visible track changes |
137
- | `rev new <name>` | Create new project from template |
138
- | `rev new --list` | List available templates |
139
- | `rev install` | Check/install dependencies (pandoc-crossref) |
140
-
141
- ### Import & Export
142
-
143
- | Command | Description |
144
- |---------|-------------|
145
- | `rev import <docx>` | Bootstrap project from Word (creates sections + rev.yaml) |
146
- | `rev import <docx> <md>` | Import changes by diffing Word against your MD |
147
- | `rev sections <docx>` | Import Word doc to existing section files |
148
- | `rev extract <docx>` | Extract plain text from Word |
149
-
150
- ### Review & Edit
151
-
152
- | Command | Description |
153
- |---------|-------------|
154
- | `rev review <file>` | Interactive accept/reject TUI for track changes |
155
- | `rev status <file>` | Show annotation counts |
156
- | `rev comments <file>` | List all comments with context |
157
- | `rev comments <file> --export comments.csv` | Export comments to CSV |
158
- | `rev resolve <file> -n 1` | Mark comment #1 as resolved |
159
- | `rev strip <file>` | Output clean Markdown (annotations applied) |
160
-
161
- ### Cross-References
162
-
163
- | Command | Description |
164
- |---------|-------------|
165
- | `rev refs [file]` | Show figure/table registry and reference status |
166
- | `rev migrate <file>` | Convert hardcoded refs (Fig. 1) to dynamic (@fig:label) |
167
-
168
- ### Comments & Replies
169
-
170
- | Command | Description |
171
- |---------|-------------|
172
- | `rev config user "Name"` | Set your name for replies |
173
- | `rev reply <file>` | Interactive reply to reviewer comments |
174
- | `rev reply <file> -n 1 -m "text"` | Reply to specific comment (non-interactive) |
175
-
176
- ### Bibliography & DOIs
177
-
178
- | Command | Description |
179
- |---------|-------------|
180
- | `rev doi check [file.bib]` | Validate DOIs in bibliography (Crossref + DataCite) |
181
- | `rev doi lookup [file.bib]` | Search for missing DOIs by title/author/year |
182
- | `rev doi fetch <doi>` | Fetch BibTeX entry from DOI |
183
- | `rev doi add <doi>` | Fetch and add DOI entry to bibliography |
184
-
185
- ### Validation & Analysis
186
-
187
- | Command | Description |
188
- |---------|-------------|
189
- | `rev citations [file.bib]` | Validate citations against bibliography |
190
- | `rev figures [file]` | List figures/tables with reference counts |
191
- | `rev equations list` | List all equations in section files |
192
- | `rev equations from-word <docx>` | Extract equations from Word to LaTeX |
193
- | `rev response [files]` | Generate response letter from comments |
194
- | `rev anonymize <file>` | Prepare document for blind review |
195
- | `rev validate --journal <name>` | Check manuscript against journal requirements |
196
- | `rev validate --list` | List available journal profiles |
197
-
198
- ### Multi-Reviewer & Git
199
-
200
- | Command | Description |
201
- |---------|-------------|
202
- | `rev merge <md> <docx...>` | Merge feedback from multiple Word documents |
203
- | `rev diff [ref]` | Compare sections against git history |
204
- | `rev history [file]` | Show revision history for sections |
205
-
206
- ### Configuration
207
-
208
- | Command | Description |
209
- |---------|-------------|
210
- | `rev init` | Generate sections.yaml from existing .md files |
211
- | `rev split <file>` | Split annotated paper.md back to section files |
212
- | `rev help [topic]` | Show help (topics: workflow, syntax, commands) |
213
-
214
- ### Convenience Commands
215
-
216
- | Command | Description |
217
- |---------|-------------|
218
- | `rev word-count` | Show word counts per section |
219
- | `rev word-count -j <journal>` | Warn if over journal word limit |
220
- | `rev stats` | Project dashboard (words, figures, citations) |
221
- | `rev search <query>` | Search across all section files |
222
- | `rev backup` | Create timestamped backup zip |
223
- | `rev export` | Export project as distributable zip |
224
- | `rev preview <format>` | Build and open document |
225
- | `rev watch [format]` | Auto-rebuild on file changes |
226
- | `rev lint` | Check for broken refs, missing citations |
227
-
228
- ### Grammar & Style
229
-
230
- | Command | Description |
231
- |---------|-------------|
232
- | `rev grammar` | Check grammar/style issues |
233
- | `rev grammar --rules` | List available grammar rules |
234
- | `rev grammar --learn <word>` | Add word to custom dictionary |
235
- | `rev grammar --list` | Show custom dictionary |
236
-
237
- ### Spelling
238
-
239
- | Command | Description |
240
- |---------|-------------|
241
- | `rev spelling` | Check spelling in all sections |
242
- | `rev spelling --british` | Use British English dictionary |
243
- | `rev spelling --learn <word>` | Add word to global dictionary |
244
- | `rev spelling --learn-project <word>` | Add word to project dictionary |
245
- | `rev spelling --list` | Show global dictionary |
246
- | `rev spelling --list-all` | Show global + project dictionaries |
247
-
248
- ### Direct DOCX Editing
249
-
250
- | Command | Description |
251
- |---------|-------------|
252
- | `rev annotate <docx>` | Add comments to Word document |
253
- | `rev apply <md> <docx>` | Apply annotations as track changes |
254
- | `rev comment <docx>` | Interactive comment mode |
255
-
256
- ## Project Structure
257
-
258
- A typical rev project:
106
+ ### Citations
259
107
 
108
+ In your `.bib` file:
109
+ ```bibtex
110
+ @article{Smith2020,
111
+ author = {Smith, Jane},
112
+ title = {My Paper Title},
113
+ journal = {Nature},
114
+ year = {2020}
115
+ }
260
116
  ```
261
- my-paper/
262
- ├── rev.yaml # Project config (title, authors, build settings)
263
- ├── introduction.md # Section files
264
- ├── methods.md
265
- ├── results.md
266
- ├── discussion.md
267
- ├── references.bib # Bibliography
268
- ├── figures/ # Images
269
- ├── paper.md # Combined output (generated)
270
- ├── my-paper.pdf # PDF output (generated)
271
- └── my-paper.docx # Word output (generated)
117
+
118
+ In your text:
119
+ ```markdown
120
+ Previous studies have shown this effect [@Smith2020].
121
+ Multiple citations work too [@Smith2020; @Jones2021].
272
122
  ```
273
123
 
274
- ## Configuration (rev.yaml)
275
-
276
- ```yaml
277
- title: "Your Paper Title"
278
- authors:
279
- - name: First Author
280
- affiliation: Institution
281
- email: author@example.com
282
-
283
- sections:
284
- - introduction.md
285
- - methods.md
286
- - results.md
287
- - discussion.md
288
-
289
- bibliography: references.bib
290
- csl: nature.csl # Optional citation style
291
-
292
- crossref:
293
- figureTitle: Figure
294
- tableTitle: Table
295
- figPrefix: [Fig., Figs.]
296
- tblPrefix: [Table, Tables]
297
-
298
- pdf:
299
- documentclass: article
300
- fontsize: 12pt
301
- geometry: margin=1in
302
- linestretch: 1.5
303
- toc: false # Table of contents
304
-
305
- docx:
306
- reference: template.docx # Optional reference doc
307
- keepComments: true
308
- toc: false # Table of contents
124
+ Becomes: "Previous studies have shown this effect (Smith 2020)."
125
+
126
+ ### Equations
127
+
128
+ Inline: `$E = mc^2$` → E = mc²
129
+
130
+ Display equation:
131
+ ```markdown
132
+ $$
133
+ \hat{p} = \frac{\sum_d w_d p_d}{\sum_d w_d}
134
+ $$
309
135
  ```
310
136
 
311
- ## Annotation Syntax (CriticMarkup)
137
+ ### Figures
312
138
 
313
139
  ```markdown
314
- {++inserted text++} # Insertions
315
- {--deleted text--} # Deletions
316
- {~~old~>new~~} # Substitutions
317
- {>>Author: comment<<} # Comments
140
+ ![Map of study sites across Europe](figures/map.png){#fig:map}
141
+
142
+ As shown in @fig:map, our study sites span 12 countries.
318
143
  ```
319
144
 
320
- ## Template Variables
145
+ In Word: "As shown in Figure 1, our study sites..."
321
146
 
322
- Use template variables in section files (processed during build):
147
+ The figure number updates automatically if you reorder figures.
323
148
 
324
- ```markdown
325
- Last updated: {{date}}
326
- Version: {{version}}
327
- Word count: {{word_count}}
149
+ ---
150
+
151
+ ## Build Your Document
152
+
153
+ ```bash
154
+ rev build docx # Generate Word document
155
+ rev build pdf # Generate PDF
156
+ rev build --dual # Both clean + with-comments versions
157
+ ```
158
+
159
+ ### Preview While Writing
160
+
161
+ ```bash
162
+ rev watch docx # Auto-rebuilds when you save
328
163
  ```
329
164
 
330
- | Variable | Description |
331
- |----------|-------------|
332
- | `{{date}}` | Current date (YYYY-MM-DD) |
333
- | `{{date:MMMM D, YYYY}}` | Custom format (December 29, 2025) |
334
- | `{{year}}` | Current year |
335
- | `{{version}}` | Version from rev.yaml |
336
- | `{{title}}` | Document title |
337
- | `{{author}}` | First author name |
338
- | `{{authors}}` | All authors (comma-separated) |
339
- | `{{word_count}}` | Total word count |
165
+ ---
340
166
 
341
- ## Comment Replies
167
+ ## Handle Reviewer Feedback
342
168
 
343
- Reply to reviewer comments with your name:
169
+ ### 1. Receive Reviewed Document
170
+
171
+ Your supervisor sends back `manuscript_reviewed.docx` with comments and track changes.
344
172
 
345
173
  ```bash
346
- # Set your name (once)
347
- rev config user "Gilles Colling"
174
+ rev sections manuscript_reviewed.docx
175
+ ```
348
176
 
349
- # Interactive: go through each comment
350
- rev reply methods.md
177
+ This imports their changes into your Markdown files.
351
178
 
352
- # Non-interactive: reply to specific comment
353
- rev reply methods.md -n 1 -m "Done, added clarification"
179
+ ### 2. See Their Comments
180
+
181
+ ```bash
182
+ rev comments methods.md
354
183
  ```
355
184
 
356
- Creates a conversation thread:
357
- ```markdown
358
- {>>Reviewer: Please clarify this<<} {>>Gilles Colling: Added in next paragraph<<}
185
+ Output:
359
186
  ```
187
+ #1 [Dr. Smith] line 45
188
+ "Please clarify the sampling methodology"
360
189
 
361
- Claude can also reply programmatically using the non-interactive mode.
190
+ #2 [Dr. Smith] line 78
191
+ "Add a citation here"
192
+ ```
362
193
 
363
- ## Cross-Reference System
194
+ ### 3. Reply to Comments
364
195
 
365
- Use dynamic references in your source:
196
+ ```bash
197
+ rev config user "Your Name" # Set your name (once)
198
+ rev reply methods.md -n 1 -m "Added detail about random sampling in paragraph 2"
199
+ ```
366
200
 
367
- ```markdown
368
- ![Caption](figures/img.png){#fig:heatmap}
201
+ ### 4. Rebuild and Send Back
369
202
 
370
- See @fig:heatmap for the results.
203
+ ```bash
204
+ rev build --dual
371
205
  ```
372
206
 
373
- When importing from Word, hardcoded refs are auto-converted:
374
- - `Figure 1` `@fig:heatmap`
375
- - `Fig. 2a` `@fig:model`
376
- - `Figs. 1-3` → `@fig:heatmap; @fig:model; @fig:hierarchy`
377
- - `Figures 1, 2, and 3` → `@fig:one; @fig:two; @fig:three`
378
- - `Fig. 1a-c` → `@fig:one` (expands letter suffixes)
379
- - `Figs. 1a-3b` → all panels from 1a to 3b
207
+ Creates:
208
+ - `paper.docx` Clean version
209
+ - `paper_comments.docx` With threaded comment conversations
380
210
 
381
- ## Build Outputs
211
+ Your reply appears under their comment, just like a conversation in Word.
382
212
 
383
- | Format | Annotations | Cross-refs |
384
- |--------|-------------|------------|
385
- | PDF | Stripped (clean) | `@fig:label` → "Figure 1" |
386
- | DOCX | Comments kept | `@fig:label` → "Figure 1" |
387
- | TEX | Stripped (clean) | LaTeX labels |
213
+ ---
388
214
 
389
- ## DOI Management
215
+ ## Why Separate Files?
390
216
 
391
- Check and find DOIs for your bibliography:
217
+ Instead of one giant document, docrev uses separate files for each section:
392
218
 
393
- ```bash
394
- # Validate all DOIs in references.bib
395
- rev doi check references.bib
219
+ | File | Content |
220
+ |------|---------|
221
+ | `introduction.md` | Background, aims, hypotheses |
222
+ | `methods.md` | Study design, analysis |
223
+ | `results.md` | Findings |
224
+ | `discussion.md` | Interpretation |
225
+
226
+ **Benefits:**
227
+ - Easier to navigate
228
+ - Work on one section without scrolling
229
+ - Git shows changes per section
230
+ - Collaborators can review specific parts
231
+
232
+ ---
233
+
234
+ ## Commands Reference
235
+
236
+ | What you want to do | Command |
237
+ |---------------------|---------|
238
+ | Create new paper | `rev new my-paper` |
239
+ | Import from Word | `rev import manuscript.docx` |
240
+ | Build Word doc | `rev build docx` |
241
+ | Build PDF | `rev build pdf` |
242
+ | Import reviewer feedback | `rev sections reviewed.docx` |
243
+ | See all comments | `rev comments methods.md` |
244
+ | Reply to comment #1 | `rev reply methods.md -n 1 -m "Fixed"` |
245
+ | Check word count | `rev word-count` |
246
+ | Validate DOIs | `rev doi check` |
247
+ | Check before submission | `rev check` |
396
248
 
397
- # Look up missing DOIs automatically
398
- rev doi lookup references.bib --confidence medium
249
+ See [full documentation](docs/commands.md) for all commands.
399
250
 
400
- # Fetch BibTeX from a DOI
401
- rev doi fetch 10.1038/nature12373
251
+ ---
252
+
253
+ ## Requirements
254
+
255
+ - **Node.js 18+** — [Download](https://nodejs.org/)
256
+ - **Pandoc** — Converts Markdown to Word/PDF
257
+
258
+ ```bash
259
+ # macOS
260
+ brew install pandoc
402
261
 
403
- # Add a citation by DOI
404
- rev doi add 10.1038/nature12373
262
+ # Windows
263
+ winget install JohnMacFarlane.Pandoc
264
+
265
+ # Linux
266
+ sudo apt install pandoc
405
267
  ```
406
268
 
407
- **Features:**
408
- - Validates DOIs via Crossref API (+ DataCite for Zenodo/Figshare)
409
- - Smart lookup using title, author, year, and journal matching
410
- - Filters out supplement/figure DOIs and F1000 reviews
411
- - Confidence levels: `high`, `medium`, `low` (use `--confidence low` to see all matches)
412
- - Skip entries with `nodoi = {true}` or `% no-doi` comment
269
+ ---
270
+
271
+ ## FAQ
272
+
273
+ **Q: Do my collaborators need to install docrev?**
274
+ No. They keep using Word normally. You handle the conversion.
275
+
276
+ **Q: Can I use my existing Word document?**
277
+ Yes. `rev import manuscript.docx` converts it to Markdown.
278
+
279
+ **Q: What about my bibliography?**
280
+ Use a `.bib` file (export from Zotero/Mendeley/EndNote). Citations are handled automatically.
281
+
282
+ **Q: Will equations look right in Word?**
283
+ Yes. LaTeX equations are converted to native Word equations.
413
284
 
414
- ## Dependencies
285
+ **Q: What if I make a mistake?**
286
+ Plain text + Git means you can always go back. Run `rev backup` before big changes.
415
287
 
416
- - Node.js 18+
417
- - [Pandoc](https://pandoc.org/) - Document conversion
418
- - [pandoc-crossref](https://github.com/lierdakil/pandoc-crossref) - Cross-references (optional but recommended)
419
- - [mammoth](https://github.com/mwilliamson/mammoth.js) - Word document parsing
420
- - [diff](https://github.com/kpdecker/jsdiff) - Text diffing
288
+ ---
421
289
 
422
290
  ## License
423
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docrev",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Academic paper revision workflow: Word ↔ Markdown round-trips, DOI validation, reviewer comments",
5
5
  "type": "module",
6
6
  "types": "types/index.d.ts",