bun-docx 0.17.0 → 0.18.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/README.md +11 -0
- package/dist/index.js +1854 -623
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -283,6 +283,15 @@ docx tables set-widths FILE --at tN --widths "25%,25%,50%" | "1440,..." | aut
|
|
|
283
283
|
docx tables merge FILE --at tN:rR1cC1-rR2cC2
|
|
284
284
|
docx tables unmerge FILE --at tN:rRcC
|
|
285
285
|
docx tables borders FILE --at tN [--style single|double|none] [--size N] [--color HEX]
|
|
286
|
+
docx tables format FILE --at LOCATOR [--shade HEX|NAME] [--valign top|center|bottom]
|
|
287
|
+
[--halign left|center|right|justify] [--cell-borders SIDES]
|
|
288
|
+
[--align left|center|right] [--style ID] [--row-height M] [--repeat-header]
|
|
289
|
+
|
|
290
|
+
docx lists set FILE --at pN [--start N] [--format FMT] [--restart] [--continue]
|
|
291
|
+
# renumber a NUMBERED list (--at = any item; applies to the whole list).
|
|
292
|
+
# FMT = decimal | lower-alpha | upper-alpha | lower-roman | upper-roman.
|
|
293
|
+
# --restart splits a fresh list off here; --continue picks up the previous
|
|
294
|
+
# list's numbering instead of restarting. Untracked (Word records no revision).
|
|
286
295
|
|
|
287
296
|
docx track-changes on|off FILE
|
|
288
297
|
docx track-changes list FILE [--json]
|
|
@@ -430,6 +439,8 @@ docx track-changes accept doc.docx --at tc0 --at tc2 # or --all
|
|
|
430
439
|
|
|
431
440
|
**Edit & create styles.** `docx styles set FILE --at Heading1 --color 1F4E79 --size 16 --bold` rewrites the *style definition* in `word/styles.xml`, so every paragraph or run that uses the style picks up the change at once ("make all Heading 1s green") — the same run-/paragraph-formatting flags as `edit` (color/font/size/highlight/underline/caps + alignment/spacing/indentation for paragraph styles). `docx styles create FILE Callout --color C00000 --bold` mints a new paragraph or character style that `insert/edit --style Callout` can then apply. Editing an un-materialized built-in (`--at Heading3` on a doc that never used it) provisions it first; a paragraph with its own *direct* formatting keeps it (the override wins — the definition edit never touches the body). Style edits are **not** tracked changes even under track-changes — matching Word, which applies style-definition edits to `styles.xml` directly with no redline.
|
|
432
441
|
|
|
442
|
+
**List numbering.** `docx lists set FILE --at p12 --start 5` makes a numbered list begin at 5; `--format upper-roman` (or `lower-alpha`/`upper-alpha`/`lower-roman`) switches the glyph; `--restart` splits a fresh list off at that item; `--continue` makes a list pick up the previous list's numbering instead of restarting. `--at` names any item — the change applies to the whole list. The start round-trips through the markdown ordinal (the body reads `5. 6. 7.`); the glyph and any continue link, which GFM can't express, surface as a deviation-only `<!-- docx:list p12 format="upper-roman" -->` / `<!-- docx:list p20 continues -->` hint (dropped on import, like every `docx:` note — `read --ast` carries `list.start`/`list.format` losslessly). Untracked, matching Word, which records no revision for a list-numbering change.
|
|
443
|
+
|
|
433
444
|
**Run formatting beyond bold/italic.** Properties markdown has no native syntax for — text color, theme color, highlight, shading, underline (all 18 styles + color), super/subscript, small/all caps, font, and size — are emitted as the **HTML a markdown reader actually renders**, so the output looks right in GitHub, VS Code, Obsidian, and browsers (Pandoc `[text]{…}` spans render as literal brackets in all of those). `read` emits semantic tags where they exist — `<mark>overdue</mark>`, `<sup>x</sup>`, `<sub>2</sub>` — a `<span style="color:#C00000">…</span>` for the CSS-expressible properties, and `data-*` attributes for the OOXML-only ones CSS can't express (theme colors, underline styles); `insert/edit --markdown` parses them back losslessly, and a leading `<!-- docx:base font="Arial" size="8pt" -->` note declares the document's dominant font/size once so the body isn't buried in per-run repetition. Bold/italic/strike/code/links stay native (`**`/`*`/`~~`/`` ` ``/`[](…)`). Because the inline-surgery transform scans whole sibling sequences, a CriticMarkup marker or span can straddle other formatting — `{++**bold insertion**++}` is tracked correctly. An invalid enum value (e.g. a bogus highlight name) fails with a clear error rather than silently vanishing. Inserted plain content inherits the surrounding paragraph's font/size so it blends in.
|
|
434
445
|
|
|
435
446
|
**Visual verification.** `docx render` is the only command that needs an external runtime: it drives Microsoft Word (macOS via `osascript`, Windows via PowerShell COM — the ground-truth renderer) or LibreOffice (`soffice`, cross-platform) to produce a PDF, then rasterizes in-process via the bundled `@hyzyla/pdfium` WASM package — no poppler/pdftoppm/ImageMagick needed. Agents that consume PNGs use this to verify edits, diff accept/reject before-vs-after, or generate screenshots.
|