docrev 0.2.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/CLAUDE.md +75 -0
- package/README.md +313 -0
- package/bin/rev.js +2645 -0
- package/lib/annotations.js +321 -0
- package/lib/build.js +486 -0
- package/lib/citations.js +149 -0
- package/lib/config.js +60 -0
- package/lib/crossref.js +426 -0
- package/lib/doi.js +823 -0
- package/lib/equations.js +258 -0
- package/lib/format.js +420 -0
- package/lib/import.js +1018 -0
- package/lib/response.js +182 -0
- package/lib/review.js +208 -0
- package/lib/sections.js +345 -0
- package/lib/templates.js +305 -0
- package/package.json +43 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Claude Instructions for rev
|
|
2
|
+
|
|
3
|
+
This is `rev`, a CLI tool for academic paper workflows with Word ↔ Markdown round-trips.
|
|
4
|
+
|
|
5
|
+
## Key Commands for Claude
|
|
6
|
+
|
|
7
|
+
### Replying to Comments
|
|
8
|
+
When helping the user address reviewer comments, use the non-interactive reply mode:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Reply to a specific comment by number
|
|
12
|
+
rev reply <file> -n <number> -m "Your response"
|
|
13
|
+
|
|
14
|
+
# Example
|
|
15
|
+
rev reply methods.md -n 1 -m "Added clarification about sampling methodology in paragraph 2"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The user's name is already configured via `rev config user`. Replies appear as:
|
|
19
|
+
```markdown
|
|
20
|
+
{>>Reviewer: Original comment<<} {>>User Name: Your reply<<}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Viewing Comments
|
|
24
|
+
```bash
|
|
25
|
+
rev comments <file> # List all comments with context
|
|
26
|
+
rev status <file> # Show annotation counts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Building Documents
|
|
30
|
+
```bash
|
|
31
|
+
rev build # Build PDF and DOCX
|
|
32
|
+
rev build pdf # PDF only
|
|
33
|
+
rev build docx # DOCX only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Annotation Syntax (CriticMarkup)
|
|
37
|
+
|
|
38
|
+
- `{++inserted text++}` - Additions
|
|
39
|
+
- `{--deleted text--}` - Deletions
|
|
40
|
+
- `{~~old~>new~~}` - Substitutions
|
|
41
|
+
- `{>>Author: comment<<}` - Comments
|
|
42
|
+
|
|
43
|
+
## Cross-References
|
|
44
|
+
|
|
45
|
+
Use dynamic references in markdown:
|
|
46
|
+
- `@fig:label` - Figure reference (becomes "Figure 1" in Word)
|
|
47
|
+
- `@tbl:label` - Table reference
|
|
48
|
+
- `{#fig:label}` - Anchor for figures
|
|
49
|
+
|
|
50
|
+
## Project Structure
|
|
51
|
+
|
|
52
|
+
- `rev.yaml` - Project configuration
|
|
53
|
+
- `*.md` - Section files (introduction.md, methods.md, etc.)
|
|
54
|
+
- `paper.md` - Combined output (generated by build)
|
|
55
|
+
- `figures/` - Images directory
|
|
56
|
+
|
|
57
|
+
### DOI Management
|
|
58
|
+
```bash
|
|
59
|
+
rev doi check references.bib # Validate DOIs (Crossref + DataCite)
|
|
60
|
+
rev doi lookup references.bib # Find missing DOIs by title/author/year
|
|
61
|
+
rev doi fetch <doi> # Get BibTeX from DOI
|
|
62
|
+
rev doi add <doi> # Add citation to .bib file
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Options:
|
|
66
|
+
- `--confidence low|medium|high` - Filter lookup results by confidence
|
|
67
|
+
- `--strict` - Fail if articles are missing DOIs
|
|
68
|
+
- Skip entries: add `nodoi = {true}` or `% no-doi` comment before entry
|
|
69
|
+
|
|
70
|
+
## Workflow Tips
|
|
71
|
+
|
|
72
|
+
1. When user imports a reviewed Word doc, help them go through comments
|
|
73
|
+
2. Use `rev reply` to respond to each comment as you address it
|
|
74
|
+
3. After addressing all comments, run `rev build docx` to generate updated Word doc
|
|
75
|
+
4. Use `rev doi check` to validate bibliography before submission
|
package/README.md
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# docrev
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/docrev)
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g docrev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The `rev` command is now available globally.
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js 18+** - [Download](https://nodejs.org/)
|
|
18
|
+
- **Pandoc** - For building PDF/DOCX ([pandoc.org](https://pandoc.org/installing.html))
|
|
19
|
+
- **pandoc-crossref** - For figure/table refs (optional, [install](https://github.com/lierdakil/pandoc-crossref/releases))
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# macOS
|
|
23
|
+
brew install pandoc pandoc-crossref
|
|
24
|
+
|
|
25
|
+
# Ubuntu/Debian
|
|
26
|
+
sudo apt install pandoc
|
|
27
|
+
|
|
28
|
+
# Windows
|
|
29
|
+
winget install JohnMacFarlane.Pandoc
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Verify installation:
|
|
33
|
+
```bash
|
|
34
|
+
rev --version
|
|
35
|
+
rev install # Check for missing dependencies
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Integrated build system** - Combine sections → paper.md → PDF, DOCX, or LaTeX
|
|
41
|
+
- **Import from Word** - Diff Word docs against your Markdown, generating CriticMarkup annotations
|
|
42
|
+
- **Section-aware import** - Import directly to modular section files (intro.md, methods.md, etc.)
|
|
43
|
+
- **Interactive review** - Accept/reject track changes with a TUI
|
|
44
|
+
- **Comment management** - List and filter reviewer comments
|
|
45
|
+
- **DOI validation** - Check and find DOIs via Crossref/DataCite APIs
|
|
46
|
+
- **Cross-reference conversion** - Auto-convert hardcoded "Figure 1" to dynamic `@fig:label` syntax
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### Start from Word Document
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Import existing Word doc → creates section files + rev.yaml
|
|
54
|
+
rev import manuscript.docx
|
|
55
|
+
|
|
56
|
+
# Import to specific directory
|
|
57
|
+
rev import manuscript.docx -o my-paper/
|
|
58
|
+
|
|
59
|
+
# Preview without creating files
|
|
60
|
+
rev import manuscript.docx --dry-run
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### New Project from Template
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Create a new paper project
|
|
67
|
+
rev new my-paper
|
|
68
|
+
|
|
69
|
+
# or with a specific template
|
|
70
|
+
rev new my-thesis --template thesis
|
|
71
|
+
|
|
72
|
+
# List available templates
|
|
73
|
+
rev new --list
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Build Workflow
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cd my-paper
|
|
80
|
+
|
|
81
|
+
# Edit your sections
|
|
82
|
+
# introduction.md, methods.md, results.md, discussion.md
|
|
83
|
+
|
|
84
|
+
# Build PDF and Word
|
|
85
|
+
rev build
|
|
86
|
+
|
|
87
|
+
# Build specific format
|
|
88
|
+
rev build pdf
|
|
89
|
+
rev build docx
|
|
90
|
+
rev build tex
|
|
91
|
+
rev build all # PDF + DOCX + TEX
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Review Workflow
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Import reviewer's Word doc to section files
|
|
98
|
+
rev sections reviewed.docx
|
|
99
|
+
|
|
100
|
+
# Review track changes interactively
|
|
101
|
+
rev review methods.md
|
|
102
|
+
|
|
103
|
+
# See remaining comments
|
|
104
|
+
rev comments methods.md
|
|
105
|
+
|
|
106
|
+
# Rebuild
|
|
107
|
+
rev build docx
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
### Build & Create
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `rev build [formats...]` | Build PDF/DOCX/TEX from sections |
|
|
117
|
+
| `rev new <name>` | Create new project from template |
|
|
118
|
+
| `rev new --list` | List available templates |
|
|
119
|
+
| `rev install` | Check/install dependencies (pandoc-crossref) |
|
|
120
|
+
|
|
121
|
+
### Import & Export
|
|
122
|
+
|
|
123
|
+
| Command | Description |
|
|
124
|
+
|---------|-------------|
|
|
125
|
+
| `rev import <docx>` | Bootstrap project from Word (creates sections + rev.yaml) |
|
|
126
|
+
| `rev import <docx> <md>` | Import changes by diffing Word against your MD |
|
|
127
|
+
| `rev sections <docx>` | Import Word doc to existing section files |
|
|
128
|
+
| `rev extract <docx>` | Extract plain text from Word |
|
|
129
|
+
|
|
130
|
+
### Review & Edit
|
|
131
|
+
|
|
132
|
+
| Command | Description |
|
|
133
|
+
|---------|-------------|
|
|
134
|
+
| `rev review <file>` | Interactive accept/reject TUI for track changes |
|
|
135
|
+
| `rev status <file>` | Show annotation counts |
|
|
136
|
+
| `rev comments <file>` | List all comments with context |
|
|
137
|
+
| `rev strip <file>` | Output clean Markdown (annotations applied) |
|
|
138
|
+
|
|
139
|
+
### Cross-References
|
|
140
|
+
|
|
141
|
+
| Command | Description |
|
|
142
|
+
|---------|-------------|
|
|
143
|
+
| `rev refs [file]` | Show figure/table registry and reference status |
|
|
144
|
+
| `rev migrate <file>` | Convert hardcoded refs (Fig. 1) to dynamic (@fig:label) |
|
|
145
|
+
|
|
146
|
+
### Comments & Replies
|
|
147
|
+
|
|
148
|
+
| Command | Description |
|
|
149
|
+
|---------|-------------|
|
|
150
|
+
| `rev config user "Name"` | Set your name for replies |
|
|
151
|
+
| `rev reply <file>` | Interactive reply to reviewer comments |
|
|
152
|
+
| `rev reply <file> -n 1 -m "text"` | Reply to specific comment (non-interactive) |
|
|
153
|
+
|
|
154
|
+
### Bibliography & DOIs
|
|
155
|
+
|
|
156
|
+
| Command | Description |
|
|
157
|
+
|---------|-------------|
|
|
158
|
+
| `rev doi check [file.bib]` | Validate DOIs in bibliography (Crossref + DataCite) |
|
|
159
|
+
| `rev doi lookup [file.bib]` | Search for missing DOIs by title/author/year |
|
|
160
|
+
| `rev doi fetch <doi>` | Fetch BibTeX entry from DOI |
|
|
161
|
+
| `rev doi add <doi>` | Fetch and add DOI entry to bibliography |
|
|
162
|
+
|
|
163
|
+
### Configuration
|
|
164
|
+
|
|
165
|
+
| Command | Description |
|
|
166
|
+
|---------|-------------|
|
|
167
|
+
| `rev init` | Generate sections.yaml from existing .md files |
|
|
168
|
+
| `rev split <file>` | Split annotated paper.md back to section files |
|
|
169
|
+
| `rev help [topic]` | Show help (topics: workflow, syntax, commands) |
|
|
170
|
+
|
|
171
|
+
## Project Structure
|
|
172
|
+
|
|
173
|
+
A typical rev project:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
my-paper/
|
|
177
|
+
├── rev.yaml # Project config (title, authors, build settings)
|
|
178
|
+
├── introduction.md # Section files
|
|
179
|
+
├── methods.md
|
|
180
|
+
├── results.md
|
|
181
|
+
├── discussion.md
|
|
182
|
+
├── references.bib # Bibliography
|
|
183
|
+
├── figures/ # Images
|
|
184
|
+
├── paper.md # Combined output (generated)
|
|
185
|
+
├── my-paper.pdf # PDF output (generated)
|
|
186
|
+
└── my-paper.docx # Word output (generated)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Configuration (rev.yaml)
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
title: "Your Paper Title"
|
|
193
|
+
authors:
|
|
194
|
+
- name: First Author
|
|
195
|
+
affiliation: Institution
|
|
196
|
+
email: author@example.com
|
|
197
|
+
|
|
198
|
+
sections:
|
|
199
|
+
- introduction.md
|
|
200
|
+
- methods.md
|
|
201
|
+
- results.md
|
|
202
|
+
- discussion.md
|
|
203
|
+
|
|
204
|
+
bibliography: references.bib
|
|
205
|
+
csl: nature.csl # Optional citation style
|
|
206
|
+
|
|
207
|
+
crossref:
|
|
208
|
+
figureTitle: Figure
|
|
209
|
+
tableTitle: Table
|
|
210
|
+
figPrefix: [Fig., Figs.]
|
|
211
|
+
tblPrefix: [Table, Tables]
|
|
212
|
+
|
|
213
|
+
pdf:
|
|
214
|
+
documentclass: article
|
|
215
|
+
fontsize: 12pt
|
|
216
|
+
geometry: margin=1in
|
|
217
|
+
linestretch: 1.5
|
|
218
|
+
|
|
219
|
+
docx:
|
|
220
|
+
reference: template.docx # Optional reference doc
|
|
221
|
+
keepComments: true
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Annotation Syntax (CriticMarkup)
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
{++inserted text++} # Insertions
|
|
228
|
+
{--deleted text--} # Deletions
|
|
229
|
+
{~~old~>new~~} # Substitutions
|
|
230
|
+
{>>Author: comment<<} # Comments
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Comment Replies
|
|
234
|
+
|
|
235
|
+
Reply to reviewer comments with your name:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Set your name (once)
|
|
239
|
+
rev config user "Gilles Colling"
|
|
240
|
+
|
|
241
|
+
# Interactive: go through each comment
|
|
242
|
+
rev reply methods.md
|
|
243
|
+
|
|
244
|
+
# Non-interactive: reply to specific comment
|
|
245
|
+
rev reply methods.md -n 1 -m "Done, added clarification"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Creates a conversation thread:
|
|
249
|
+
```markdown
|
|
250
|
+
{>>Reviewer: Please clarify this<<} {>>Gilles Colling: Added in next paragraph<<}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Claude can also reply programmatically using the non-interactive mode.
|
|
254
|
+
|
|
255
|
+
## Cross-Reference System
|
|
256
|
+
|
|
257
|
+
Use dynamic references in your source:
|
|
258
|
+
|
|
259
|
+
```markdown
|
|
260
|
+
{#fig:heatmap}
|
|
261
|
+
|
|
262
|
+
See @fig:heatmap for the results.
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
When importing from Word, hardcoded refs are auto-converted:
|
|
266
|
+
- `Figure 1` → `@fig:heatmap`
|
|
267
|
+
- `Fig. 2a` → `@fig:model`
|
|
268
|
+
- `Figs. 1-3` → `@fig:heatmap; @fig:model; @fig:hierarchy`
|
|
269
|
+
|
|
270
|
+
## Build Outputs
|
|
271
|
+
|
|
272
|
+
| Format | Annotations | Cross-refs |
|
|
273
|
+
|--------|-------------|------------|
|
|
274
|
+
| PDF | Stripped (clean) | `@fig:label` → "Figure 1" |
|
|
275
|
+
| DOCX | Comments kept | `@fig:label` → "Figure 1" |
|
|
276
|
+
| TEX | Stripped (clean) | LaTeX labels |
|
|
277
|
+
|
|
278
|
+
## DOI Management
|
|
279
|
+
|
|
280
|
+
Check and find DOIs for your bibliography:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Validate all DOIs in references.bib
|
|
284
|
+
rev doi check references.bib
|
|
285
|
+
|
|
286
|
+
# Look up missing DOIs automatically
|
|
287
|
+
rev doi lookup references.bib --confidence medium
|
|
288
|
+
|
|
289
|
+
# Fetch BibTeX from a DOI
|
|
290
|
+
rev doi fetch 10.1038/nature12373
|
|
291
|
+
|
|
292
|
+
# Add a citation by DOI
|
|
293
|
+
rev doi add 10.1038/nature12373
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Features:**
|
|
297
|
+
- Validates DOIs via Crossref API (+ DataCite for Zenodo/Figshare)
|
|
298
|
+
- Smart lookup using title, author, year, and journal matching
|
|
299
|
+
- Filters out supplement/figure DOIs and F1000 reviews
|
|
300
|
+
- Confidence levels: `high`, `medium`, `low` (use `--confidence low` to see all matches)
|
|
301
|
+
- Skip entries with `nodoi = {true}` or `% no-doi` comment
|
|
302
|
+
|
|
303
|
+
## Dependencies
|
|
304
|
+
|
|
305
|
+
- Node.js 18+
|
|
306
|
+
- [Pandoc](https://pandoc.org/) - Document conversion
|
|
307
|
+
- [pandoc-crossref](https://github.com/lierdakil/pandoc-crossref) - Cross-references (optional but recommended)
|
|
308
|
+
- [mammoth](https://github.com/mwilliamson/mammoth.js) - Word document parsing
|
|
309
|
+
- [diff](https://github.com/kpdecker/jsdiff) - Text diffing
|
|
310
|
+
|
|
311
|
+
## License
|
|
312
|
+
|
|
313
|
+
MIT
|