bun-docx 0.4.0 → 0.5.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 +10 -2
- package/dist/index.js +1107 -297
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ bunx bun-docx read doc.docx
|
|
|
32
32
|
```sh
|
|
33
33
|
docx create FILE [--title T] [--author A] [--text "..."]
|
|
34
34
|
docx read FILE
|
|
35
|
-
docx insert FILE --after p3 --text "..." [--style HeadingN] [--color HEX] [--bold] [--italic]
|
|
35
|
+
docx insert FILE --after p3 --text "..." [--style HeadingN] [--color HEX] [--bold] [--italic] [--url URL]
|
|
36
36
|
docx insert FILE --after p3 --runs '[{"type":"text","text":"X","bold":true}]'
|
|
37
37
|
docx edit FILE --at p3 --text "..." | --runs '[...]'
|
|
38
38
|
docx delete FILE --at p3
|
|
@@ -50,6 +50,11 @@ docx images list FILE
|
|
|
50
50
|
docx images extract FILE --to ./media [--id imgN]
|
|
51
51
|
docx images replace FILE --at imgN --with ./new.png
|
|
52
52
|
|
|
53
|
+
docx hyperlinks list FILE
|
|
54
|
+
docx hyperlinks add FILE --at pN:S-E --url URL
|
|
55
|
+
docx hyperlinks replace FILE --at linkN --with URL
|
|
56
|
+
docx hyperlinks delete FILE --at linkN
|
|
57
|
+
|
|
53
58
|
docx track-changes FILE on|off
|
|
54
59
|
docx info schema [--ts]
|
|
55
60
|
docx info locators [--json]
|
|
@@ -66,7 +71,7 @@ pN paragraph N (e.g., p3)
|
|
|
66
71
|
pN:S-E characters S..E within paragraph N
|
|
67
72
|
pN:S-pM:E cross-paragraph range
|
|
68
73
|
tN table N; tN:rRcC for cell at row R, col C
|
|
69
|
-
cN, imgN
|
|
74
|
+
cN, imgN, linkN comment / image / hyperlink ids
|
|
70
75
|
```
|
|
71
76
|
|
|
72
77
|
Run `docx info locators` for the full reference.
|
|
@@ -105,6 +110,7 @@ src/
|
|
|
105
110
|
delete/ # delete FILE
|
|
106
111
|
comments/ # add | reply | resolve | delete | list
|
|
107
112
|
images/ # list | extract | replace
|
|
113
|
+
hyperlinks/ # add | list | replace | delete
|
|
108
114
|
track-changes/ # FILE on|off
|
|
109
115
|
info/ # schema | locators (reference output)
|
|
110
116
|
core/
|
|
@@ -137,6 +143,8 @@ tests/
|
|
|
137
143
|
|
|
138
144
|
**Cross-format image replacement.** `images replace --at img0 --with new.png` detects the new MIME type via `Bun.file().type`, renames the part (`word/media/image1.jpeg` → `word/media/image1.png`), rewrites the relationship `Target`, and ensures `[Content_Types].xml` has a `<Default>` for the new extension.
|
|
139
145
|
|
|
146
|
+
**Hyperlink CRUD.** `hyperlinks list` enumerates `<w:hyperlink>` elements with positional `linkN` ids; `hyperlinks add --at p3:5-20 --url URL` wraps an existing span (splitting runs at offsets); `hyperlinks replace --at link0 --with URL` updates the rels `Target`, allocating a new rId if the existing one is shared so siblings stay pointed at the original URL; `hyperlinks delete --at link0` unwraps the link (text survives) and prunes the rels entry when no longer referenced.
|
|
147
|
+
|
|
140
148
|
## CI
|
|
141
149
|
|
|
142
150
|
GitHub Actions (`.github/workflows/ci.yml`) runs four jobs on push to `main` and on PRs:
|