docx 9.10.0 → 9.11.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 +15 -0
- package/dist/html.cjs +14192 -0
- package/dist/html.d.cts +152 -0
- package/dist/html.d.ts +152 -0
- package/dist/html.iife.js +14193 -0
- package/dist/html.mjs +14190 -0
- package/dist/html.umd.cjs +14198 -0
- package/dist/index.cjs +547 -93
- package/dist/index.d.cts +131 -15
- package/dist/index.d.ts +131 -15
- package/dist/index.iife.js +547 -93
- package/dist/index.mjs +547 -93
- package/dist/index.umd.cjs +547 -93
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -92,6 +92,21 @@ const doc = new Document({
|
|
|
92
92
|
|
|
93
93
|
In a page without a bundler, load `dist/shapes.umd.cjs`, `dist/watermarks.umd.cjs` or `dist/charts.umd.cjs` after `dist/index.umd.cjs`. They add the `docxShapes`, `docxWatermarks` and `docxCharts` globals. See the [shapes](https://docx.js.org/#/usage/shapes), [watermarks](https://docx.js.org/#/usage/watermarks) and [charts](https://docx.js.org/#/usage/charts) documentation.
|
|
94
94
|
|
|
95
|
+
# HTML
|
|
96
|
+
|
|
97
|
+
HTML, such as what people write in a rich-text editor, becomes a document's paragraphs, lists, tables, images, links, equations and footnotes with `docx/html`, written in the document's own styles:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { Document } from "docx";
|
|
101
|
+
import { htmlToContent } from "docx/html";
|
|
102
|
+
|
|
103
|
+
const doc = new Document({
|
|
104
|
+
sections: [{ children: htmlToContent("<h1>Report</h1><p>Sales were <b>up 12%</b>.</p><ul><li>EMEA</li><li>APAC</li></ul>") }],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
In a page without a bundler, load `dist/html.umd.cjs` after `dist/index.umd.cjs` and `dist/math.umd.cjs`. It adds the `docxHtml` global. See the [HTML](https://docx.js.org/#/usage/html) documentation.
|
|
109
|
+
|
|
95
110
|
# Playground
|
|
96
111
|
|
|
97
112
|
Experience `docx` in action through [Docx.js Editor][docxjs-editor-url], an interactive playground where you can code and preview the results in real-time.
|