bun-docx 0.20.1 → 0.20.3
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/README.md +4 -3
- package/dist/index.js +11 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -226,9 +226,10 @@ size="…in" margins="…in" text-width="…in" -->` note when the page deviates
|
|
|
226
226
|
so the importer drops it (it can't re-inject into the body); full entries are in
|
|
227
227
|
`read --ast` under `headers`/`footers` (`Marginal[]`). Set with `docx
|
|
228
228
|
headers`/`docx footers`.
|
|
229
|
-
- **Track-changes state** rides a head `<!-- docx:track-changes on -->`
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
- **Track-changes state** always rides a head `<!-- docx:track-changes on|off -->`
|
|
230
|
+
line — it's the one read hint that states its default too (an agent shouldn't have
|
|
231
|
+
to infer "off" from a missing line), so you can see whether subsequent edits will be
|
|
232
|
+
redlined without inspecting `settings.xml`.
|
|
232
233
|
Toggle it with `docx track-changes FILE on|off`; the three tracked-change read views
|
|
233
234
|
(`--accepted`/`--current`/`--baseline`) are covered under the review loop below.
|
|
234
235
|
|
package/dist/index.js
CHANGED
|
@@ -82768,23 +82768,21 @@ function detectMarkdownInPlainText(text6) {
|
|
|
82768
82768
|
return "a link ([text](url))";
|
|
82769
82769
|
return null;
|
|
82770
82770
|
}
|
|
82771
|
-
async function rejectMarkdownInText(text6
|
|
82771
|
+
async function rejectMarkdownInText(text6) {
|
|
82772
82772
|
const found = detectMarkdownInPlainText(text6);
|
|
82773
82773
|
if (!found)
|
|
82774
82774
|
return null;
|
|
82775
|
-
return await fail("USAGE", `--text writes literal characters, but this value looks like markdown: ${found}. It would be baked in verbatim (e.g. literal ** around the word), not rendered.`, `Use --markdown to parse it (handles ${found}, headings, lists, links), --bold/--italic for a uniformly-emphasized run, or --runs for literal text that really contains these characters
|
|
82776
|
-
${help}`);
|
|
82775
|
+
return await fail("USAGE", `--text writes literal characters, but this value looks like markdown: ${found}. It would be baked in verbatim (e.g. literal ** around the word), not rendered.`, `Use --markdown to parse it (handles ${found}, headings, lists, links), --bold/--italic for a uniformly-emphasized run, or --runs for literal text that really contains these characters.`);
|
|
82777
82776
|
}
|
|
82778
82777
|
function detectShellMangledCurrency(text6) {
|
|
82779
82778
|
const match = text6.match(/(?<![\d$])([.,]\d{2,})/);
|
|
82780
82779
|
return match?.[1] ?? null;
|
|
82781
82780
|
}
|
|
82782
|
-
async function rejectShellMangledValue(text6,
|
|
82781
|
+
async function rejectShellMangledValue(text6, label = "this value") {
|
|
82783
82782
|
const fragment = detectShellMangledCurrency(text6);
|
|
82784
82783
|
if (!fragment)
|
|
82785
82784
|
return null;
|
|
82786
|
-
return await fail("USAGE", `${label} contains "${fragment}" \u2014 a number with no integer part, the signature of a "$" amount gutted by the shell (bash turns double-quoted "$300.00" into ".00" and "$10,000" into ",000"). docx would write the corrupted value verbatim.`, `Wrap any "$"-bearing value in SINGLE quotes ('$300.00') so bash leaves it alone, or supply it via --batch FILE (JSONL never touches the shell). If you really mean "${fragment}", write its integer part (0${fragment}) or use --batch
|
|
82787
|
-
${help}`);
|
|
82785
|
+
return await fail("USAGE", `${label} contains "${fragment}" \u2014 a number with no integer part, the signature of a "$" amount gutted by the shell (bash turns double-quoted "$300.00" into ".00" and "$10,000" into ",000"). docx would write the corrupted value verbatim.`, `Wrap any "$"-bearing value in SINGLE quotes ('$300.00') so bash leaves it alone, or supply it via --batch FILE (JSONL never touches the shell). If you really mean "${fragment}", write its integer part (0${fragment}) or use --batch.`);
|
|
82788
82786
|
}
|
|
82789
82787
|
function decodeInlineEscapes(value) {
|
|
82790
82788
|
if (value === undefined)
|
|
@@ -85930,10 +85928,10 @@ async function validateParagraphEdit(values2, paragraphOptions) {
|
|
|
85930
85928
|
}
|
|
85931
85929
|
return { kind: "removeLine" };
|
|
85932
85930
|
}
|
|
85933
|
-
const rejected = await rejectMarkdownInText(text6
|
|
85931
|
+
const rejected = await rejectMarkdownInText(text6);
|
|
85934
85932
|
if (typeof rejected === "number")
|
|
85935
85933
|
return rejected;
|
|
85936
|
-
const mangled = await rejectShellMangledValue(text6,
|
|
85934
|
+
const mangled = await rejectShellMangledValue(text6, "--text");
|
|
85937
85935
|
if (typeof mangled === "number")
|
|
85938
85936
|
return mangled;
|
|
85939
85937
|
return {
|
|
@@ -88875,10 +88873,10 @@ async function buildSingleShotOptions(filePath, values2) {
|
|
|
88875
88873
|
if (typeof spec === "number")
|
|
88876
88874
|
return spec;
|
|
88877
88875
|
if (spec.kind === "text") {
|
|
88878
|
-
const rejected = await rejectMarkdownInText(spec.text
|
|
88876
|
+
const rejected = await rejectMarkdownInText(spec.text);
|
|
88879
88877
|
if (typeof rejected === "number")
|
|
88880
88878
|
return rejected;
|
|
88881
|
-
const mangled = await rejectShellMangledValue(spec.text,
|
|
88879
|
+
const mangled = await rejectShellMangledValue(spec.text, "--text");
|
|
88882
88880
|
if (typeof mangled === "number")
|
|
88883
88881
|
return mangled;
|
|
88884
88882
|
}
|
|
@@ -91709,7 +91707,7 @@ function renderMarkdown2(doc, options = {}) {
|
|
|
91709
91707
|
return "";
|
|
91710
91708
|
const baseNote = formatBaseNote(noteBaseline);
|
|
91711
91709
|
const pageNote = formatPageNote(documentGeometry(blocks));
|
|
91712
|
-
const trackNote =
|
|
91710
|
+
const trackNote = formatNote("track-changes", [], [options.trackChangesOn ? "on" : "off"]);
|
|
91713
91711
|
const wrapSummary = formatWrappingTabSummary(ctx.wrappingTabLines);
|
|
91714
91712
|
const headLines = [
|
|
91715
91713
|
baseNote,
|
|
@@ -94852,7 +94850,7 @@ async function run43(args) {
|
|
|
94852
94850
|
}
|
|
94853
94851
|
const cellTexts = parsed.values.cells ? parsed.values.cells.split(",") : [];
|
|
94854
94852
|
for (const cell of cellTexts) {
|
|
94855
|
-
const mangled = await rejectShellMangledValue(cell,
|
|
94853
|
+
const mangled = await rejectShellMangledValue(cell, "--cells");
|
|
94856
94854
|
if (typeof mangled === "number")
|
|
94857
94855
|
return mangled;
|
|
94858
94856
|
}
|
|
@@ -98017,7 +98015,7 @@ Examples:
|
|
|
98017
98015
|
// package.json
|
|
98018
98016
|
var package_default = {
|
|
98019
98017
|
name: "bun-docx",
|
|
98020
|
-
version: "0.20.
|
|
98018
|
+
version: "0.20.3",
|
|
98021
98019
|
description: "Read, edit, redline, and comment on Microsoft Word .docx files from the command line \u2014 built for AI agents.",
|
|
98022
98020
|
keywords: [
|
|
98023
98021
|
"docx",
|