Commit Graph
13 Commits
Author SHA1 Message Date
DolanandClaude Opus 5.5 c169dd1a83 feat: live examples in the docs, which run, draw the document next to the code, and can be edited and downloaded (#3556)
* feat: live examples in the docs, which run, draw the document next to the code, and can be edited and downloaded

The docs' code examples were plain snippets, often fragments that couldn't run. A code block marked ```ts live is now
an example readers can see and change: the page runs it with docx, draws the document it makes next to the code with
docx-preview, and offers the .docx to download. Clicking the code opens an editor (Monaco) that knows docx's types,
the pages are drawn again as the code changes, and View closes the editor. Split, Code and Preview show the code and
the pages side by side, or one of them. The demos a page includes are live too.

Every example in the docs that builds or patches a document is now live: 443 of them, each a whole file with its
imports, so it runs as written. Code about other things, such as installing, bundlers or servers, stays plain.

Running them showed docs that were wrong, fixed here:
- Landscape: docx swaps a landscape page's width and height itself, so the docs' swapped sizes made a tall page
  marked as landscape
- Comments: `comments.children` takes plain objects, not `new Comment(...)`
- Custom properties are text only
- APIs that no longer exist: MathText, Row, `.then` on Packer.toStream, patchDocument(buffer, ...),
  createParagraph().heading1(), a border's `value`, TextRun's `.break()`
- The templates and patcher examples read files that aren't in the repository. They now patch the templates in
  demo/assets, or make their own

`npm run build.docs` copies docx's browser builds into docs/live-examples/lib, so the docs use the docx they
describe, and the Pages workflow runs it. The folder is gitignored, and cspell and ESLint skip it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

* docs: the bullet examples draw a bullet, and the patcher's usage writes the patched document

"ὠ" is U+1F60, a Greek omega, since \u takes four hex digits, so the two live bullet examples on
the numbering page drew it as each item's bullet. They use "•" now. The patcher's usage example
now awaits patchDocument and writes the document it makes, as the example after it does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 13:00:29 +01:00
DolanandClaude Opus 5.5 be95a8c1bb feat: theme colours for the page background, and templates' themes in patchDocument (#3538)
- Document's background.color takes a ThemeColor, written with w:themeColor,
  w:themeTint or w:themeShade and the hex colour it comes to. The released
  themeColor, themeTint and themeShade strings still work, and are deprecated.
- patchDocument reads the template's theme colours (a:srgbClr, a:sysClr), so
  theme colours in patches get the template's hex value rather than Office's.
- Demo 119 has a page background in a theme colour. Docs updated.


Claude-Session: https://claude.ai/code/session_01TmyffPd5QMJYjXiMBQ3EnZ

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 00:46:30 +01:00
Dolan 811e5d9b97 feat: write a theme part, with theme fonts for text and theme colours for shapes (#3536) 2026-09-24 20:23:52 +01:00
f734656001 build(deps-dev): bump prettier from 3.8.3 to 3.9.8 (#3509)
* build(deps-dev): bump prettier from 3.8.3 to 3.9.8

Bumps [prettier](https://github.com/prettier/prettier) from 3.8.3 to 3.9.8.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.9.8)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.9.8
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* style(docs): reformat code samples for prettier 3.9

Prettier 3.9 keeps arrays and objects containing only a block comment
on a single line (e.g. `[/* ... */]`), which failed the Prettier CI check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 14:03:29 +01:00
Dolan 3539c06e92 docs: Improve inline docs and docs website (#3353)
* docs: Improve inline docs and docs website

* Fix lint

* Fix spelling
2026-02-14 03:54:25 +00:00
Bálint TáborszkiandDolan Miu c6bb255641 Add hyphenation support (#2678)
* Add hyphenation support

* Remove unneeded linebreaks

* Add documentation and fix eslint

* Add tests

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-11-21 10:41:31 +00:00
Dolan Miu 988987ddbe #1126 - Add all comptability options 2022-10-29 15:10:02 +01:00
Dolan 37e610d2b3 Fix typo 2020-10-30 00:13:52 +00:00
Dolan ed52ef358b Background color for document 2020-10-27 01:54:40 +00:00
Dolan Miu 820e5edc1e Using const rather than var and let, and using ts rather than js examples 2019-08-06 17:51:13 +01:00
Dolan c2c05b0140 Adding some documentation 2019-08-03 13:42:24 +01:00
Eli Flanagan 249e44532f add documentation on positioning units
See further discussions in #50, #191.
2018-12-11 16:49:18 -05:00
Dolan 7d116d1ce9 Add more documentation 2018-08-04 03:28:27 +01:00