docrev 0.9.15 → 0.9.16

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 (41) hide show
  1. package/README.md +41 -46
  2. package/dist/lib/wordcomments.d.ts.map +1 -1
  3. package/dist/lib/wordcomments.js +25 -2
  4. package/dist/lib/wordcomments.js.map +1 -1
  5. package/docs-src/build.py +113 -0
  6. package/docs-src/extra.css +208 -0
  7. package/docs-src/md-to-html.lua +6 -0
  8. package/docs-src/template.html +116 -0
  9. package/lib/wordcomments.ts +25 -2
  10. package/mkdocs.yml +64 -0
  11. package/package.json +1 -1
  12. package/site/assets/extra.css +208 -0
  13. package/site/commands.html +926 -0
  14. package/site/configuration.html +469 -0
  15. package/site/index.html +288 -0
  16. package/site/troubleshooting.html +461 -0
  17. package/site/workflow.html +518 -0
  18. package/dev_notes/bug_repro_comment_parser.md +0 -71
  19. package/dev_notes/stress2/adversarial.docx +0 -0
  20. package/dev_notes/stress2/build_adversarial.ts +0 -186
  21. package/dev_notes/stress2/drift_matcher.ts +0 -62
  22. package/dev_notes/stress2/probe_anchors.ts +0 -35
  23. package/dev_notes/stress2/project/adversarial.docx +0 -0
  24. package/dev_notes/stress2/project/discussion.before.md +0 -3
  25. package/dev_notes/stress2/project/discussion.md +0 -3
  26. package/dev_notes/stress2/project/methods.before.md +0 -20
  27. package/dev_notes/stress2/project/methods.md +0 -20
  28. package/dev_notes/stress2/project/rev.yaml +0 -5
  29. package/dev_notes/stress2/project/sections.yaml +0 -4
  30. package/dev_notes/stress2/sections.yaml +0 -5
  31. package/dev_notes/stress2/trace_placement.ts +0 -50
  32. package/dev_notes/stresstest_boundaries.ts +0 -27
  33. package/dev_notes/stresstest_drift_apply.ts +0 -43
  34. package/dev_notes/stresstest_drift_compare.ts +0 -43
  35. package/dev_notes/stresstest_drift_v2.ts +0 -54
  36. package/dev_notes/stresstest_inspect.ts +0 -54
  37. package/dev_notes/stresstest_pstyle.ts +0 -55
  38. package/dev_notes/stresstest_section_debug.ts +0 -23
  39. package/dev_notes/stresstest_split.ts +0 -70
  40. package/dev_notes/stresstest_trace.ts +0 -19
  41. package/dev_notes/stresstest_verify_no_overwrite.ts +0 -40
@@ -0,0 +1,116 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-bs-theme="light">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>$if(pagetitle)$$pagetitle$ — $endif$docrev</title>
7
+ <meta name="description" content="CLI for writing documents in Markdown while collaborating with Word users.">
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.3/dist/sandstone/bootstrap.min.css">
9
+ $if(highlighting-css)$
10
+ <style>
11
+ $highlighting-css$
12
+ </style>
13
+ $endif$
14
+ <link rel="stylesheet" href="assets/extra.css">
15
+ </head>
16
+ <body>
17
+
18
+ <nav class="navbar navbar-expand-lg fixed-top" aria-label="Site navigation">
19
+ <div class="container">
20
+ <a class="navbar-brand me-2" href="index.html">docrev</a>
21
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-main" aria-controls="navbar-main" aria-expanded="false" aria-label="Toggle navigation">
22
+ <span class="navbar-toggler-icon"></span>
23
+ </button>
24
+ <div class="collapse navbar-collapse" id="navbar-main">
25
+ <ul class="navbar-nav me-auto">
26
+ <li class="nav-item">
27
+ <a class="nav-link$if(active-home)$ active$endif$" $if(active-home)$aria-current="page"$endif$ href="index.html">Home</a>
28
+ </li>
29
+ <li class="nav-item">
30
+ <a class="nav-link$if(active-workflow)$ active$endif$" $if(active-workflow)$aria-current="page"$endif$ href="workflow.html">Get Started</a>
31
+ </li>
32
+ <li class="nav-item">
33
+ <a class="nav-link$if(active-commands)$ active$endif$" $if(active-commands)$aria-current="page"$endif$ href="commands.html">Commands</a>
34
+ </li>
35
+ <li class="nav-item">
36
+ <a class="nav-link$if(active-configuration)$ active$endif$" $if(active-configuration)$aria-current="page"$endif$ href="configuration.html">Configuration</a>
37
+ </li>
38
+ <li class="nav-item">
39
+ <a class="nav-link$if(active-troubleshooting)$ active$endif$" $if(active-troubleshooting)$aria-current="page"$endif$ href="troubleshooting.html">Troubleshooting</a>
40
+ </li>
41
+ </ul>
42
+ <ul class="navbar-nav">
43
+ <li class="nav-item">
44
+ <button id="theme-toggle" class="btn btn-link nav-link border-0" aria-label="Toggle dark mode">
45
+ <svg id="icon-sun" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
46
+ <path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8M8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0m0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13m8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5M3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8m10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0m-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0m9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707M4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707"/>
47
+ </svg>
48
+ <svg id="icon-moon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" style="display:none">
49
+ <path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278"/>
50
+ </svg>
51
+ </button>
52
+ </li>
53
+ <li class="nav-item">
54
+ <a class="nav-link" href="https://github.com/gcol33/docrev" aria-label="GitHub">
55
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
56
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
57
+ </svg>
58
+ </a>
59
+ </li>
60
+ <li class="nav-item">
61
+ <a class="nav-link" href="https://www.npmjs.com/package/docrev" aria-label="npm">
62
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
63
+ <path d="M0 0v16h16V0zm5.333 13.333H2.667V5.333h2.666v5.334H8V5.333h2.667v8H5.333z"/>
64
+ </svg>
65
+ </a>
66
+ </li>
67
+ </ul>
68
+ </div>
69
+ </div>
70
+ </nav>
71
+
72
+ <div class="container template-$if(active-home)$home$else$article$endif$">
73
+ <div class="row">
74
+ <main id="main" class="$if(toc)$col-md-9$else$col-12$endif$">
75
+ $body$
76
+ </main>
77
+ $if(toc)$
78
+ <aside class="col-md-3 d-none d-md-block">
79
+ <nav id="toc" data-toggle="toc" aria-label="On this page">
80
+ <h2 class="h6">On this page</h2>
81
+ <div class="toc">$toc$</div>
82
+ </nav>
83
+ </aside>
84
+ $endif$
85
+ </div>
86
+ </div>
87
+
88
+ <footer class="border-top py-3 mt-auto">
89
+ <div class="container d-flex justify-content-between align-items-center text-muted" style="font-size:.85rem">
90
+ <span>docrev$if(version)$ $version$$endif$</span>
91
+ <span>Built with <a href="https://pandoc.org" class="text-muted">pandoc</a></span>
92
+ </div>
93
+ </footer>
94
+
95
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
96
+ <script>
97
+ (function () {
98
+ var html = document.documentElement;
99
+ var sun = document.getElementById('icon-sun');
100
+ var moon = document.getElementById('icon-moon');
101
+ function apply(t) {
102
+ html.setAttribute('data-bs-theme', t);
103
+ sun.style.display = t === 'dark' ? 'none' : '';
104
+ moon.style.display = t === 'dark' ? '' : 'none';
105
+ }
106
+ apply(localStorage.getItem('docrev-theme') || 'light');
107
+ document.getElementById('theme-toggle').addEventListener('click', function () {
108
+ var next = html.getAttribute('data-bs-theme') === 'dark' ? 'light' : 'dark';
109
+ localStorage.setItem('docrev-theme', next);
110
+ apply(next);
111
+ });
112
+ })();
113
+ </script>
114
+
115
+ </body>
116
+ </html>
@@ -478,8 +478,31 @@ export async function injectCommentsAtMarkers(
478
478
  const startMarker = `${MARKER_START_PREFIX}${idx}${MARKER_SUFFIX}`;
479
479
  const endMarker = `${MARKER_END_PREFIX}${idx}${MARKER_SUFFIX}`;
480
480
 
481
- const startPos = documentXml.indexOf(startMarker);
482
- const endPos = documentXml.indexOf(endMarker, startPos + startMarker.length);
481
+ // Pandoc duplicates inline image alt-text into <wp:docPr descr="...">
482
+ // metadata attributes AND into the visible caption paragraph. A naive
483
+ // indexOf hits the metadata-attribute occurrence first, where there is
484
+ // no <w:t> element so dissectRun fails. Skip occurrences whose position
485
+ // is inside an XML tag (last unbalanced '<' before position).
486
+ // See: https://github.com/gcol33/docrev/issues/4
487
+ function findInTextContent(haystack: string, needle: string, fromIdx = 0): number {
488
+ let i = fromIdx;
489
+ while (true) {
490
+ const p = haystack.indexOf(needle, i);
491
+ if (p < 0) return -1;
492
+ const lastLt = haystack.lastIndexOf('<', p);
493
+ const lastGt = haystack.lastIndexOf('>', p);
494
+ if (lastLt > lastGt) {
495
+ i = p + 1;
496
+ continue;
497
+ }
498
+ return p;
499
+ }
500
+ }
501
+
502
+ const startPos = findInTextContent(documentXml, startMarker);
503
+ const endPos = startPos === -1
504
+ ? -1
505
+ : findInTextContent(documentXml, endMarker, startPos + startMarker.length);
483
506
 
484
507
  if (startPos === -1 || endPos === -1) continue;
485
508
 
package/mkdocs.yml ADDED
@@ -0,0 +1,64 @@
1
+ site_name: docrev
2
+ site_url: https://gillescolling.com/docrev
3
+ site_description: CLI for writing documents in Markdown while collaborating with Word users.
4
+ site_author: Gilles Colling
5
+ repo_url: https://github.com/gcol33/docrev
6
+ repo_name: gcol33/docrev
7
+
8
+ theme:
9
+ name: material
10
+ palette:
11
+ - scheme: default
12
+ primary: custom
13
+ accent: custom
14
+ toggle:
15
+ icon: material/brightness-7
16
+ name: Switch to dark mode
17
+ - scheme: slate
18
+ primary: custom
19
+ accent: custom
20
+ toggle:
21
+ icon: material/brightness-4
22
+ name: Switch to light mode
23
+ font:
24
+ text: Roboto
25
+ code: Roboto Mono
26
+ features:
27
+ - navigation.tabs
28
+ - navigation.top
29
+ - navigation.instant
30
+ - search.highlight
31
+ - content.code.copy
32
+ icon:
33
+ repo: fontawesome/brands/github
34
+
35
+ nav:
36
+ - Home: index.md
37
+ - Get Started: workflow.md
38
+ - Commands: commands.md
39
+ - Configuration: configuration.md
40
+ - Troubleshooting: troubleshooting.md
41
+
42
+ markdown_extensions:
43
+ - pymdownx.highlight:
44
+ anchor_linenums: true
45
+ - pymdownx.superfences
46
+ - pymdownx.inlinehilite
47
+ - pymdownx.tabbed:
48
+ alternate_style: true
49
+ - admonition
50
+ - pymdownx.details
51
+ - attr_list
52
+ - md_in_html
53
+ - toc:
54
+ permalink: true
55
+
56
+ extra_css:
57
+ - stylesheets/extra.css
58
+
59
+ extra:
60
+ social:
61
+ - icon: fontawesome/brands/github
62
+ link: https://github.com/gcol33/docrev
63
+ - icon: fontawesome/brands/npm
64
+ link: https://www.npmjs.com/package/docrev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docrev",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "description": "Academic paper revision workflow: Word ↔ Markdown round-trips, DOI validation, reviewer comments",
5
5
  "type": "module",
6
6
  "types": "dist/lib/types.d.ts",
@@ -0,0 +1,208 @@
1
+ /* ── Base ──────────────────────────────────────────────── */
2
+ html, body {
3
+ height: 100%;
4
+ }
5
+
6
+ body {
7
+ background-color: #F5F6F8;
8
+ color: #3E3F3A;
9
+ display: flex;
10
+ flex-direction: column;
11
+ min-height: 100vh;
12
+ padding-top: 4rem;
13
+ font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
14
+ }
15
+
16
+ .container { flex: 1; }
17
+ footer { margin-top: auto; }
18
+
19
+ /* ── Navbar (pkgdown-style subtle tint, not bg-primary) ── */
20
+ .navbar {
21
+ background: color-mix(in oklab, color-mix(in oklab, var(--bs-body-bg) 95%, var(--bs-primary)) 95%, var(--bs-body-color));
22
+ border-bottom: 1px solid #DFD7CA;
23
+ line-height: initial;
24
+ }
25
+
26
+ .navbar .nav-link.active {
27
+ font-weight: 600;
28
+ color: var(--bs-primary) !important;
29
+ }
30
+
31
+ /* ── Links ─────────────────────────────────────────────── */
32
+ a { color: #325D88; }
33
+ a:hover { color: #1E3D5C; }
34
+
35
+ /* ── Headings ──────────────────────────────────────────── */
36
+ h1 { font-size: 2rem; font-weight: 600; margin-bottom: 1rem; }
37
+ h2 {
38
+ font-size: 1.4rem; font-weight: 600;
39
+ margin-top: 2rem; margin-bottom: .65rem;
40
+ padding-bottom: .3rem;
41
+ border-bottom: 1px solid #DFD7CA;
42
+ }
43
+ h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }
44
+ h4 { font-size: 1rem; font-weight: 600; margin-top: 1.2rem; }
45
+
46
+ /* ── Code ──────────────────────────────────────────────── */
47
+ pre, div.sourceCode {
48
+ background-color: #EEEEED;
49
+ border: 1px solid #DFD7CA;
50
+ border-radius: .375rem;
51
+ padding: .9rem 1.1rem;
52
+ font-size: .85rem;
53
+ overflow-x: auto;
54
+ margin: 1em 0;
55
+ }
56
+
57
+ code {
58
+ background-color: #EEEEED;
59
+ color: #3E3F3A;
60
+ border-radius: .25rem;
61
+ padding: .1em .35em;
62
+ font-size: .875em;
63
+ }
64
+
65
+ pre code, div.sourceCode code {
66
+ background: none;
67
+ padding: 0;
68
+ border-radius: 0;
69
+ font-size: inherit;
70
+ color: inherit;
71
+ }
72
+
73
+ div.sourceCode { padding: 0; }
74
+ div.sourceCode pre { border: none; margin: 0; }
75
+
76
+ /* ── Tables ────────────────────────────────────────────── */
77
+ table {
78
+ width: 100%;
79
+ border-collapse: collapse;
80
+ margin: 1em 0;
81
+ font-size: .9rem;
82
+ }
83
+
84
+ thead th {
85
+ background-color: #DFD7CA;
86
+ color: #3E3F3A;
87
+ font-weight: 600;
88
+ padding: .5rem .75rem;
89
+ border-bottom: 2px solid #c8c0b4;
90
+ text-align: left;
91
+ }
92
+
93
+ td, th { padding: .4rem .75rem; border-bottom: 1px solid #e8e2d8; }
94
+ tbody tr:hover { background-color: rgba(223,215,202,.2); }
95
+
96
+ /* ── TOC sidebar ───────────────────────────────────────── */
97
+ aside#toc, aside .toc, aside nav.toc { font-size: .875rem; }
98
+
99
+ aside h2.h6 {
100
+ text-transform: uppercase;
101
+ font-size: .68rem;
102
+ letter-spacing: .07em;
103
+ color: #6c757d;
104
+ font-weight: 600;
105
+ margin-bottom: .5rem;
106
+ border: none;
107
+ padding: 0;
108
+ }
109
+
110
+ aside .toc, aside #TOC {
111
+ position: sticky;
112
+ top: 5rem;
113
+ max-height: calc(100vh - 6rem);
114
+ overflow-y: auto;
115
+ }
116
+
117
+ aside ul {
118
+ list-style: none;
119
+ padding-left: .9rem;
120
+ margin: 0;
121
+ }
122
+ aside > nav > .toc > ul,
123
+ aside .toc > ul { padding-left: 0; }
124
+
125
+ aside li { margin: .1rem 0; }
126
+
127
+ aside a {
128
+ color: #6c757d;
129
+ text-decoration: none;
130
+ display: block;
131
+ line-height: 1.55;
132
+ }
133
+ aside a:hover { color: #325D88; }
134
+
135
+ /* ── Home page cards ───────────────────────────────────── */
136
+ .doc-card {
137
+ border: 1px solid #DFD7CA;
138
+ border-radius: .375rem;
139
+ padding: 1.1rem 1.25rem;
140
+ height: 100%;
141
+ background: #fff;
142
+ transition: border-color .15s, box-shadow .15s;
143
+ }
144
+ .doc-card:hover {
145
+ border-color: #325D88;
146
+ box-shadow: 0 2px 8px rgba(50,93,136,.1);
147
+ }
148
+ .doc-card h5 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
149
+ .doc-card p { font-size: .875rem; color: #6c757d; margin-bottom: .6rem; }
150
+ .doc-card a.stretched-link::after { z-index: 1; }
151
+
152
+ /* ── Badges row ────────────────────────────────────────── */
153
+ .badge-row { margin-bottom: 1rem; line-height: 2; }
154
+ .badge-row img { margin-right: .25rem; }
155
+
156
+ /* ── ── ── DARK MODE ── ── ── ──────────────────────────── */
157
+
158
+ [data-bs-theme="dark"] body { background-color: #343739; color: #DFD7CA; }
159
+
160
+ [data-bs-theme="dark"] .navbar {
161
+ background: color-mix(in oklab, color-mix(in oklab, #343739 92%, var(--bs-primary)) 95%, #DFD7CA);
162
+ border-bottom-color: #495057;
163
+ }
164
+
165
+ [data-bs-theme="dark"] a { color: #7ba8d0; }
166
+ [data-bs-theme="dark"] a:hover { color: #a5c4e8; }
167
+
168
+ [data-bs-theme="dark"] .navbar .nav-link.active { color: #7ba8d0 !important; }
169
+
170
+ [data-bs-theme="dark"] h1,
171
+ [data-bs-theme="dark"] h2,
172
+ [data-bs-theme="dark"] h3,
173
+ [data-bs-theme="dark"] h4 { color: #DFD7CA; }
174
+
175
+ [data-bs-theme="dark"] h2 { border-color: #495057; }
176
+
177
+ [data-bs-theme="dark"] pre,
178
+ [data-bs-theme="dark"] div.sourceCode {
179
+ background-color: #2C2F31;
180
+ border-color: #495057;
181
+ color: #DFD7CA;
182
+ }
183
+
184
+ [data-bs-theme="dark"] code {
185
+ background-color: #2C2F31;
186
+ color: #DFD7CA;
187
+ }
188
+
189
+ [data-bs-theme="dark"] div.sourceCode span[class] { color: #DFD7CA !important; }
190
+
191
+ [data-bs-theme="dark"] thead th {
192
+ background-color: #3d4043;
193
+ color: #DFD7CA;
194
+ border-color: #495057;
195
+ }
196
+ [data-bs-theme="dark"] td,
197
+ [data-bs-theme="dark"] th { border-color: #3d4043; }
198
+ [data-bs-theme="dark"] tbody tr:hover { background-color: rgba(73,80,87,.3); }
199
+
200
+ [data-bs-theme="dark"] aside a { color: #8e9499; }
201
+ [data-bs-theme="dark"] aside a:hover { color: #7ba8d0; }
202
+
203
+ [data-bs-theme="dark"] .doc-card {
204
+ background: #2C2F31;
205
+ border-color: #495057;
206
+ }
207
+ [data-bs-theme="dark"] .doc-card:hover { border-color: #7ba8d0; }
208
+ [data-bs-theme="dark"] .doc-card p { color: #8e9499; }