docrev 0.9.17 → 0.9.18
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/dist/lib/anchor-match.d.ts +1 -1
- package/dist/lib/anchor-match.d.ts.map +1 -1
- package/dist/lib/anchor-match.js +17 -47
- package/dist/lib/anchor-match.js.map +1 -1
- package/dist/lib/build.d.ts +111 -1
- package/dist/lib/build.d.ts.map +1 -1
- package/dist/lib/build.js +351 -21
- package/dist/lib/build.js.map +1 -1
- package/dist/lib/commands/build.d.ts.map +1 -1
- package/dist/lib/commands/build.js +25 -10
- package/dist/lib/commands/build.js.map +1 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +37 -0
- package/dist/lib/schema.js.map +1 -1
- package/docs-src/build.py +113 -113
- package/docs-src/extra.css +208 -208
- package/docs-src/md-to-html.lua +6 -6
- package/docs-src/template.html +116 -116
- package/issues.md +180 -0
- package/lib/anchor-match.ts +17 -49
- package/lib/build.ts +410 -22
- package/lib/commands/build.ts +32 -10
- package/lib/schema.ts +37 -0
- package/mkdocs.yml +64 -64
- package/package.json +1 -1
- package/site/assets/extra.css +208 -0
- package/site/commands.html +926 -0
- package/site/configuration.html +469 -0
- package/site/index.html +288 -0
- package/site/troubleshooting.html +461 -0
- package/site/workflow.html +518 -0
- package/skill/REFERENCE.md +66 -0
- package/skill/SKILL.md +25 -4
- package/.claude/settings.local.json +0 -9
package/docs-src/template.html
CHANGED
|
@@ -1,116 +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>
|
|
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>
|
package/issues.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# docrev — Open Issues
|
|
2
|
+
|
|
3
|
+
Three issues identified during real-world use on the ADAPT proposal build. Working through one by one.
|
|
4
|
+
|
|
5
|
+
Status legend: `[ ]` planned · `[~]` in progress · `[x]` shipped
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Issue 1 — Allow custom pandoc filters / args through `rev build` `[x]`
|
|
10
|
+
|
|
11
|
+
### Problem
|
|
12
|
+
|
|
13
|
+
Source markdown with custom raw-LaTeX commands needs a pandoc filter to convert them for docx (e.g. `\tofill{X}` → bold `[X]`). `rev build docx` has no escape hatch:
|
|
14
|
+
|
|
15
|
+
- `rev build --help` exposes no `--filter` / `--lua-filter` / `--pandoc-arg`.
|
|
16
|
+
- `rev.yaml` exposes `docx.reference` and `docx.keepComments` but no generic pandoc passthrough.
|
|
17
|
+
|
|
18
|
+
Working around it requires letting `rev build` produce `paper.md` as a side effect, then calling pandoc manually — which defeats the point of `rev build`.
|
|
19
|
+
|
|
20
|
+
### Design (agreed)
|
|
21
|
+
|
|
22
|
+
**rev.yaml**: top-level `pandoc-args` (applied to every format) plus per-format `<format>.pandoc-args` (concatenated *after* the top-level list so format-specific can override):
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
pandoc-args:
|
|
26
|
+
- --lua-filter=tofill_filter.lua
|
|
27
|
+
docx:
|
|
28
|
+
pandoc-args:
|
|
29
|
+
- --lua-filter=docx_only.lua
|
|
30
|
+
pdf:
|
|
31
|
+
pandoc-args:
|
|
32
|
+
- --variable=papersize:a4
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**CLI**: repeatable `--pandoc-arg <arg>` on `rev build`, appended *after* config args so CLI wins:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
rev build docx --pandoc-arg=--lua-filter=tofill.lua --pandoc-arg=--shift-heading-level-by=1
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Verbose mode**: `rev build --verbose` already exists but doesn't echo the pandoc invocation. Print the full `pandoc <args>` command (one line per format) so users can copy-paste to replicate manually.
|
|
42
|
+
|
|
43
|
+
### Touch points
|
|
44
|
+
|
|
45
|
+
- `lib/build.ts` — `BuildConfig` + `DEFAULT_CONFIG` (add `pandocArgs: string[]`; add `pandocArgs` to each format config), `buildPandocArgs()` (append top-level then format-specific), `runPandoc()` (echo command under verbose), `loadConfig()` (read hyphenated `pandoc-args` key and map to camelCase `pandocArgs`).
|
|
46
|
+
- `lib/commands/build.ts` — add `--pandoc-arg <arg>` (repeatable via custom collector), forward through `BuildOptions`, ensure CLI args are appended last.
|
|
47
|
+
- `lib/schema.ts` — declare `pandoc-args` (array of strings) at top level and inside each format object.
|
|
48
|
+
- `skill/SKILL.md` + `skill/REFERENCE.md` — document new field and flag with a `--lua-filter=` example.
|
|
49
|
+
- `test/build.test.js` — cover (a) top-level only, (b) format-specific only, (c) both concatenated in order, (d) CLI overrides config.
|
|
50
|
+
|
|
51
|
+
### Open questions
|
|
52
|
+
|
|
53
|
+
None. Hyphenated YAML key + camelCase TS field is consistent with how the rest of the schema is read (we're already free-form on the JS side, just need a small key transform in `loadConfig`).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Issue 2 — Output filename is auto-truncated mid-word and not configurable `[x]`
|
|
58
|
+
|
|
59
|
+
### Problem
|
|
60
|
+
|
|
61
|
+
Default output landed at `output/adapt-alien-dark-diversity-across-plant-communitie.docx` — title slugified and hard-truncated at 50 chars (`communitie` missing the trailing `s`). No `-o` flag, no `output:` field in `rev.yaml`.
|
|
62
|
+
|
|
63
|
+
Root cause: `lib/build.ts:1055-1056` (`runPandoc`) and `lib/commands/build.ts:591-592` (`--show-changes` path):
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const baseName = config.title
|
|
67
|
+
? config.title.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 50)
|
|
68
|
+
: 'paper';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`.slice(0, 50)` is a blind cut.
|
|
72
|
+
|
|
73
|
+
### Design (agreed)
|
|
74
|
+
|
|
75
|
+
**rev.yaml**: per-format `output:` map. Extensions optional — added if missing.
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
output:
|
|
79
|
+
docx: ADAPT_proposal_draft.docx
|
|
80
|
+
pdf: ADAPT_proposal_draft.pdf
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**CLI**: `-o, --output <path>` on `rev build`. When multiple formats are built, applies as basename to all (extension swapped per format); for single-format builds, used verbatim.
|
|
84
|
+
|
|
85
|
+
**Truncation fix**: when no `output:` is configured, slug at last `-` boundary at-or-before 50 chars instead of mid-word. Also bump the cap to 80 — 50 is conservative.
|
|
86
|
+
|
|
87
|
+
**Doc fix**: surface the default `output/` directory in `rev build --help` and SKILL.md "Project Structure" tree (already mentioned in passing — make it explicit).
|
|
88
|
+
|
|
89
|
+
### Touch points
|
|
90
|
+
|
|
91
|
+
- `lib/build.ts` — `BuildConfig` (`output?: Record<string, string>`), `DEFAULT_CONFIG`, `runPandoc()` (resolve filename: `config.output[format]` → CLI `-o` → slug). Helper: `resolveOutputName(config, format, cliOverride)`.
|
|
92
|
+
- `lib/commands/build.ts` — add `-o, --output <path>` flag, wire into `BuildOptions`; same fix applied to the `--show-changes` branch's `baseName` construction.
|
|
93
|
+
- `lib/schema.ts` — declare `output` as object mapping format → string.
|
|
94
|
+
- `skill/SKILL.md` — "Project Structure" tree explicitly notes `output/`; new `output:` example under config.
|
|
95
|
+
- `test/build.test.js` — cover (a) `output:` per-format honored, (b) `-o` CLI override, (c) word-boundary truncation when title >50 chars.
|
|
96
|
+
|
|
97
|
+
### Resolved
|
|
98
|
+
|
|
99
|
+
- `-o` relative paths resolve under `outputDir`; absolute paths bypass it. Same rule applies to values in `output:`.
|
|
100
|
+
- Cap raised from 50 → 80 chars; fallback truncates at the last `-` boundary at-or-before the cap so words stay whole (the ADAPT title now slugs cleanly without losing the trailing "s" on "communities").
|
|
101
|
+
- `--show-changes` and `--dual` derived filenames (`-changes.docx`, `_comments.docx`, `_comments.pdf`) follow the chosen base name.
|
|
102
|
+
- Fixed an unrelated misleading example in SKILL.md that showed `output: { docx: { reference-doc: ... } }` — the real config key is `docx.reference` (top-level), not nested under `output:`.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Issue 3 — Raw LaTeX figure blocks silently disappear in docx builds `[x]`
|
|
107
|
+
|
|
108
|
+
### Problem
|
|
109
|
+
|
|
110
|
+
Source markdown with `\begin{figure}[H]\includegraphics{...}\end{figure}` blocks renders correctly in the PDF target but produces a docx where all figures are silently missing. Pandoc strips the raw LaTeX because docx has no LaTeX rendering pipeline. No warning is emitted.
|
|
111
|
+
|
|
112
|
+
This catches you only on careful inspection — a less careful user would ship a docx with no figures and not notice until a reviewer asks.
|
|
113
|
+
|
|
114
|
+
### Design (agreed)
|
|
115
|
+
|
|
116
|
+
Three layers, combined:
|
|
117
|
+
|
|
118
|
+
**1. Warn during build (always on).** In `applyFormatTransforms()` for docx, scan for raw LaTeX figure environments (`\begin{figure}` … `\end{figure}` containing `\includegraphics`). Emit:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Warning: 3 raw LaTeX figure block(s) won't render in docx.
|
|
122
|
+
intro.md:42 \begin{figure}[H] ... \includegraphics{figures/map.pdf} ...
|
|
123
|
+
methods.md:118
|
|
124
|
+
results.md:201
|
|
125
|
+
Hint: use {#fig:label width=80%} for format-portable figures, or
|
|
126
|
+
pass --pandoc-arg=--lua-filter=<your.lua> to translate them yourself.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Counted by file/line so the user can jump to fix.
|
|
130
|
+
|
|
131
|
+
**2. Auto-translate the common shape (opt-out via `docx.translateRawFigures: false`).** Convert
|
|
132
|
+
|
|
133
|
+
```latex
|
|
134
|
+
\begin{figure}[H]
|
|
135
|
+
\centering
|
|
136
|
+
\includegraphics[width=0.8\textwidth]{figures/map.pdf}
|
|
137
|
+
\caption{Map of study sites.}
|
|
138
|
+
\label{fig:map}
|
|
139
|
+
\end{figure}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
→
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
{#fig:map width=80%}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Cover the 80% case. If the block has anything more exotic (`\subfloat`, `\rotatebox`, multi-`\includegraphics`), skip auto-translate, warn loudly, and leave the block as-is.
|
|
149
|
+
|
|
150
|
+
Width conversion: `0.8\textwidth` → `80%`; bare `8cm` → `8cm`; missing → omit.
|
|
151
|
+
|
|
152
|
+
**3. Document.** SKILL.md "Cross-References" section currently mentions `@fig:label` and `{#fig:label}` but doesn't show how to *insert* a figure. Add:
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
{#fig:foo width=80%}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Note this is the format-portable form. Also mention that raw `\begin{figure}` blocks are PDF-only.
|
|
159
|
+
|
|
160
|
+
### Touch points
|
|
161
|
+
|
|
162
|
+
- `lib/build.ts` — new helper `detectRawLatexFigures(content): {file?, line, block}[]` and `translateRawLatexFigures(content): {translated, untranslatedCount}`. Wire into `applyFormatTransforms()` for docx (after `convertDynamicRefsToDisplay`).
|
|
163
|
+
- `lib/build.ts` — propagate warnings up via the existing `warnings: string[]` returned by `build()`. `rev build` already prints from there.
|
|
164
|
+
- `lib/commands/build.ts` — surface warnings in normal output (not just verbose).
|
|
165
|
+
- `lib/schema.ts` — declare `docx.translateRawFigures: boolean` (default true).
|
|
166
|
+
- `skill/SKILL.md` — figure-insertion example under "Cross-References".
|
|
167
|
+
- `test/build.test.js` — cover (a) detection counts blocks correctly, (b) auto-translate of `\includegraphics{path}`, (c) auto-translate of `\includegraphics[width=0.8\textwidth]{path}` → `width=80%`, (d) exotic block → not translated, warned, left alone, (e) opt-out via `translateRawFigures: false`.
|
|
168
|
+
|
|
169
|
+
### Open questions
|
|
170
|
+
|
|
171
|
+
- Should auto-translate also handle bare `\includegraphics{...}` outside a `figure` env? Lean no — keep scope to figure environments. If a user writes raw `\includegraphics` without wrapping, that's a deliberate choice we shouldn't second-guess.
|
|
172
|
+
- Width unit handling: `0.8\textwidth` → `80%` is unambiguous. `\linewidth` → `100%`? Yes. Other relative units → leave raw and warn.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Working order
|
|
177
|
+
|
|
178
|
+
1. **Issue 1** first — unblocks immediate workflow needs and provides the manual escape hatch for issue 3 even before auto-translate ships.
|
|
179
|
+
2. **Issue 2** next — small, low-risk, quality-of-life win.
|
|
180
|
+
3. **Issue 3** last — biggest behavior change; benefits from the verbose pandoc echo (Issue 1) for debugging the lua-filter fallback path.
|
package/lib/anchor-match.ts
CHANGED
|
@@ -11,8 +11,6 @@ export type AnchorStrategy =
|
|
|
11
11
|
| 'stripped'
|
|
12
12
|
| 'partial-start'
|
|
13
13
|
| 'partial-start-stripped'
|
|
14
|
-
| 'partial-window'
|
|
15
|
-
| 'partial-window-stripped'
|
|
16
14
|
| 'context-both'
|
|
17
15
|
| 'context-before'
|
|
18
16
|
| 'context-after'
|
|
@@ -173,69 +171,41 @@ export function findAnchorInText(
|
|
|
173
171
|
return { occurrences, matchedAnchor: anchor, strategy: 'stripped', stripped: true };
|
|
174
172
|
}
|
|
175
173
|
|
|
176
|
-
// Strategy 4:
|
|
177
|
-
// Sliding the window across the anchor catches the case where the
|
|
178
|
-
// anchor's prefix has been edited but a chunk in the middle/end
|
|
179
|
-
// survived intact (e.g. "Sensitivity analyses were performed by
|
|
180
|
-
// perturbing the prior variance" → drifted "Sensitivity analyses
|
|
181
|
-
// perturbed the prior variance" still contains "the prior variance").
|
|
174
|
+
// Strategy 4: first N words of anchor (long anchors)
|
|
182
175
|
const words = anchor.split(/\s+/);
|
|
183
176
|
if (words.length > 3) {
|
|
184
177
|
for (let n = Math.min(6, words.length); n >= 3; n--) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
let occ = findAllOccurrences(textLower, windowLower);
|
|
191
|
-
if (occ.length > 0) {
|
|
192
|
-
const strategy: AnchorStrategy = start === 0 ? 'partial-start' : 'partial-window';
|
|
193
|
-
return { occurrences: occ, matchedAnchor: window, strategy };
|
|
178
|
+
const partialAnchor = words.slice(0, n).join(' ').toLowerCase();
|
|
179
|
+
if (partialAnchor.length >= 15) {
|
|
180
|
+
occurrences = findAllOccurrences(textLower, partialAnchor);
|
|
181
|
+
if (occurrences.length > 0) {
|
|
182
|
+
return { occurrences, matchedAnchor: words.slice(0, n).join(' '), strategy: 'partial-start' };
|
|
194
183
|
}
|
|
195
|
-
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
occurrences = findAllOccurrences(strippedLower, partialAnchor);
|
|
185
|
+
if (occurrences.length > 0) {
|
|
186
|
+
return {
|
|
187
|
+
occurrences,
|
|
188
|
+
matchedAnchor: words.slice(0, n).join(' '),
|
|
189
|
+
strategy: 'partial-start-stripped',
|
|
190
|
+
stripped: true,
|
|
191
|
+
};
|
|
199
192
|
}
|
|
200
193
|
}
|
|
201
194
|
}
|
|
202
195
|
}
|
|
203
196
|
|
|
204
|
-
// Strategy 5: context (before/after) only
|
|
205
|
-
//
|
|
206
|
-
// For a non-empty anchor that already failed every text-based strategy
|
|
207
|
-
// above, we treat context as a degraded placement: classify it
|
|
208
|
-
// 'context-only' so callers can warn the user. We also reject
|
|
209
|
-
// implausible brackets — if both contexts match but the gap between
|
|
210
|
-
// them is far too small to contain the anchor (e.g. the anchored
|
|
211
|
-
// sentence was deleted), do not silently land the comment between
|
|
212
|
-
// the surviving sentences. Return 'failed' so the user is told to
|
|
213
|
-
// place it manually.
|
|
197
|
+
// Strategy 5: context (before/after) only
|
|
214
198
|
if (before || after) {
|
|
215
199
|
const beforeLower = before.toLowerCase();
|
|
216
200
|
const afterLower = after.toLowerCase();
|
|
217
|
-
const anchorLen = anchor.length;
|
|
218
201
|
|
|
219
202
|
if (before && after) {
|
|
220
203
|
const beforeIdx = textLower.indexOf(beforeLower.slice(-50));
|
|
221
204
|
if (beforeIdx !== -1) {
|
|
222
205
|
const searchStart = beforeIdx + beforeLower.slice(-50).length;
|
|
223
206
|
const afterIdx = textLower.indexOf(afterLower.slice(0, 50), searchStart);
|
|
224
|
-
if (afterIdx !== -1) {
|
|
225
|
-
|
|
226
|
-
// Require the bracket to plausibly contain a remnant of the anchor.
|
|
227
|
-
// Below 30% of anchor length: anchor was deleted — refuse to place.
|
|
228
|
-
// Above 2× anchor length + slack: brackets are too far apart, the
|
|
229
|
-
// matcher has latched onto unrelated repeats of common context.
|
|
230
|
-
const minGap = Math.floor(anchorLen * 0.3);
|
|
231
|
-
const maxGap = Math.min(500, anchorLen * 2 + 50);
|
|
232
|
-
if (gap >= minGap && gap <= maxGap) {
|
|
233
|
-
return { occurrences: [searchStart], matchedAnchor: null, strategy: 'context-both' };
|
|
234
|
-
}
|
|
235
|
-
// Both brackets found but gap implausible: anchor likely deleted.
|
|
236
|
-
// Don't fall back to single-side context — that would silently
|
|
237
|
-
// place the comment in the wrong location.
|
|
238
|
-
return { occurrences: [], matchedAnchor: null, strategy: 'failed' };
|
|
207
|
+
if (afterIdx !== -1 && afterIdx - searchStart < 500) {
|
|
208
|
+
return { occurrences: [searchStart], matchedAnchor: null, strategy: 'context-both' };
|
|
239
209
|
}
|
|
240
210
|
}
|
|
241
211
|
}
|
|
@@ -292,8 +262,6 @@ export function classifyStrategy(strategy: AnchorStrategy, occurrences: number):
|
|
|
292
262
|
case 'stripped':
|
|
293
263
|
case 'partial-start':
|
|
294
264
|
case 'partial-start-stripped':
|
|
295
|
-
case 'partial-window':
|
|
296
|
-
case 'partial-window-stripped':
|
|
297
265
|
case 'split-match':
|
|
298
266
|
return 'drift';
|
|
299
267
|
case 'context-both':
|