otomate 0.3.0 → 0.3.1
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/SKILL.md +4 -1
- package/dist/otomate.js +4373 -4324
- package/dist/otomate.js.map +1 -1
- package/dist/otomate.umd.cjs +44 -44
- package/dist/otomate.umd.cjs.map +1 -1
- package/guides/html-to-docx-and-back.md +6 -14
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -298,6 +298,7 @@ These CSS properties are understood by `writeDocx` (via `@otomate/css-docx`). An
|
|
|
298
298
|
| `font-style: italic` | `w:i` |
|
|
299
299
|
| `color: #333` | `w:color` |
|
|
300
300
|
| `background-color: yellow` | `w:shd` |
|
|
301
|
+
| `background: #cee6ce` (shorthand) | `w:shd` — first color token wins |
|
|
301
302
|
| `text-decoration: underline` | `w:u val="single"` |
|
|
302
303
|
| `text-decoration: line-through` | `w:strike` |
|
|
303
304
|
|
|
@@ -310,7 +311,9 @@ These CSS properties are understood by `writeDocx` (via `@otomate/css-docx`). An
|
|
|
310
311
|
| `line-height: 1.5` | `w:spacing line` |
|
|
311
312
|
| `margin-left/right: 0.5in` | `w:ind left/right` (twips) |
|
|
312
313
|
| `border: 1pt solid #000` (and `border-top/right/bottom/left`) | `w:pBdr` (per side) |
|
|
314
|
+
| `border-style: solid` + `border-color: #5cb85c` + `border-width: 3px` (separated) | `w:pBdr` — each property accepts the 1–4 value CSS shorthand (top/right/bottom/left) |
|
|
313
315
|
| `background-color: #fafafa` | `w:shd` |
|
|
316
|
+
| `background: #fafafa` (shorthand) | `w:shd` — first color token wins |
|
|
314
317
|
|
|
315
318
|
**Color formats accepted**: named colors, `#rgb`, `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, `hsla()`. Alpha is dropped (OOXML has no alpha channel).
|
|
316
319
|
|
|
@@ -319,7 +322,7 @@ These CSS properties are understood by `writeDocx` (via `@otomate/css-docx`). An
|
|
|
319
322
|
## Gotchas (ranked by how often they bite)
|
|
320
323
|
|
|
321
324
|
1. **`writeDocx`, `readDocx`, `writeDiffDocx` are async.** Forgetting `await` leaves you holding a `Promise<Uint8Array>` instead of a buffer — `fs.writeFileSync` will then fail or write garbage. `readHtml`/`writeHtml` are synchronous; don't await them.
|
|
322
|
-
2. **Node ≥20
|
|
325
|
+
2. **Works in both Node ≥20 and modern browsers** — the docx path uses the Web Crypto API internally (not `node:crypto`), so the library is fully universal. You can `readDocx`/`writeDocx` in a browser, a worker, Deno, Bun, or an edge runtime the same way you would in Node.
|
|
323
326
|
3. **Pass a buffer, not a path.** `readDocx(buffer)` expects `Uint8Array` or `ArrayBuffer`. Call `fs.readFileSync("file.docx")` first.
|
|
324
327
|
4. **Marks are flat.** Put bold on a text node via `text("x", [strong()])`, not `strong(text("x"))`. The builders enforce this — `strong()` returns a `Mark`, not a wrapper node.
|
|
325
328
|
5. **CSS class names get sanitized for OOXML.** Only `[A-Za-z0-9_\-:]` survives and the result is clamped to 31 characters. A class like `"my class!"` becomes `"myclass"` in the generated Word style. Keep class names alphanumeric if you want 1:1 fidelity.
|