@md2nativedocx/pandoc-filter 0.7.0 → 0.8.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/bin/md2nativedocx-core.mjs +8 -1
- package/md2nativedocx.lua +10 -0
- package/package.json +2 -2
|
@@ -48,7 +48,10 @@
|
|
|
48
48
|
* inherited by `packages/cli/bin/md2nativedocx.mjs`'s `execFile` call, which
|
|
49
49
|
* counts `md2nativedocx: `-prefixed lines and surfaces them (CLI stdout
|
|
50
50
|
* summary + a `.log` file next to the output; the VS Code extension turns
|
|
51
|
-
* the count into a toast).
|
|
51
|
+
* the count into a toast). `RenderResult.metadata.notes` (a correct flowchart
|
|
52
|
+
* drawn as shapes because SmartArt cannot take it) are written as
|
|
53
|
+
* `md2nativedocx (info): <text>`: reported, never counted as warnings. The ODF
|
|
54
|
+
* path has no SmartArt, hence no notes. A source that does not parse prints
|
|
52
55
|
* `md2nativedocx: <message>` and exits 1.
|
|
53
56
|
*/
|
|
54
57
|
|
|
@@ -63,6 +66,9 @@ import {
|
|
|
63
66
|
DiagramTooLargeError,
|
|
64
67
|
} from '@md2nativedocx/core';
|
|
65
68
|
|
|
69
|
+
/** Prefix of a `metadata.notes` line on stderr: read by the CLI, never counted as a warning. */
|
|
70
|
+
const NOTE_PREFIX = 'md2nativedocx (info): ';
|
|
71
|
+
|
|
66
72
|
const inputPath = process.argv[2];
|
|
67
73
|
const odfPrefix = process.argv[3] === '--odf' ? process.argv[4] : undefined;
|
|
68
74
|
const input = inputPath ? readFileSync(inputPath, 'utf8') : readFileSync(0, 'utf8');
|
|
@@ -139,6 +145,7 @@ function renderDocx() {
|
|
|
139
145
|
for (const warning of result.metadata.warnings) {
|
|
140
146
|
process.stderr.write(`md2nativedocx: warning: ${warning}\n`);
|
|
141
147
|
}
|
|
148
|
+
for (const note of result.metadata.notes) process.stderr.write(`${NOTE_PREFIX}${note}\n`);
|
|
142
149
|
for (const part of result.parts) writePart(part);
|
|
143
150
|
return result.fragment;
|
|
144
151
|
} catch (err) {
|
package/md2nativedocx.lua
CHANGED
|
@@ -108,10 +108,20 @@ local is_odt = FORMAT == 'odt' or FORMAT == 'opendocument'
|
|
|
108
108
|
local odf_count = 0
|
|
109
109
|
local odf_styles = pandoc.List()
|
|
110
110
|
|
|
111
|
+
-- The browser converter (packages/web/src/diagram-blocks.mjs) applies the same block selection and the
|
|
112
|
+
-- same @startuml rule on Pandoc's JSON AST: keep the two in step.
|
|
113
|
+
local diagram_count = 0
|
|
114
|
+
|
|
111
115
|
local mermaid_filter = {
|
|
112
116
|
CodeBlock = function(el)
|
|
113
117
|
local lang = el.classes[1]
|
|
114
118
|
if lang ~= 'mermaid' and lang ~= 'plantuml' and lang ~= 'puml' then return nil end
|
|
119
|
+
-- Marks which diagram the warnings that follow on stderr belong to (the bridge inherits this stderr and
|
|
120
|
+
-- writes after it). `convert()` reads the marker to attribute each warning to its block, then drops it.
|
|
121
|
+
-- Only a counter and the fence's own language name, never document text.
|
|
122
|
+
diagram_count = diagram_count + 1
|
|
123
|
+
io.stderr:write('md2nativedocx-diagram: ' .. diagram_count .. ' ' .. lang .. '\n')
|
|
124
|
+
io.stderr:flush()
|
|
115
125
|
local source = el.text
|
|
116
126
|
-- A ```plantuml block may leave out @startuml/@enduml (GitLab, Kroki accept that); core recognises
|
|
117
127
|
-- PlantUML by that header, so add it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md2nativedocx/pandoc-filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Pandoc Lua filter for md2nativedocx (Markdown to native Word): converts ```mermaid code blocks in a Markdown-to-docx conversion into editable OOXML shapes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pandoc",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"test:ci": "node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=reports/junit.xml test/*.test.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@md2nativedocx/core": "0.
|
|
37
|
+
"@md2nativedocx/core": "0.8.0"
|
|
38
38
|
}
|
|
39
39
|
}
|