mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
fix: declare that docx needs Node.js 16 or later (#3807)
This commit is contained in:
@@ -15,6 +15,8 @@ Get up and running with docx in under 5 minutes.
|
||||
npm install --save docx
|
||||
```
|
||||
|
||||
In Node, docx needs Node.js 16 or later. `docx/html` and `docx/embedded-files` need 16.9 or later, and `docx/layout` 18 or later.
|
||||
|
||||
## Your First Document
|
||||
|
||||
Create a "Hello World" document in just a few lines:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
A document can have files embedded in it: a workbook, another document, a presentation, or any other file, such as a sound, a video or a PDF. Each is an OLE object, which the document shows as a picture, and which opens when it is double-clicked, as a file embedded with Word's **Insert > Object > Create from File** does.
|
||||
|
||||
`EmbeddedFileRun` embeds a file. It comes with the `docx` package, from `docx/embedded-files`, and goes in a paragraph, as an `ImageRun` does:
|
||||
`EmbeddedFileRun` embeds a file. It comes with the `docx` package, from `docx/embedded-files` (in Node, Node.js 16.9 or later), and goes in a paragraph, as an `ImageRun` does:
|
||||
|
||||
```ts
|
||||
import { Document, Packer, Paragraph } from "docx";
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
They are for HTML that comes from somewhere else, such as what people write in a rich-text editor and an app keeps, a page of a content management system, or the answer of a language model. For a document you write yourself, docx's own components say what you mean more clearly.
|
||||
|
||||
They come with the `docx` package, from `docx/html`.
|
||||
They come with the `docx` package, from `docx/html`. In Node, they need Node.js 16.9 or later.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ It can also give what is on each page, with [`layoutDocument`](#what-is-on-each-
|
||||
|
||||
## Importing
|
||||
|
||||
Layout comes with the `docx` package. Import it from `docx/layout`, and everything else from `docx`:
|
||||
Layout comes with the `docx` package. Import it from `docx/layout`, and everything else from `docx`. In Node, it needs Node.js 18 or later:
|
||||
|
||||
```ts
|
||||
import { Document, TableOfContents } from "docx";
|
||||
|
||||
Generated
+1
-1
@@ -61,7 +61,7 @@
|
||||
"vitest": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
|
||||
+1
-1
@@ -226,6 +226,6 @@
|
||||
"vitest": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=16"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user