Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/3-numbering-and-bullet-points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ const doc = new Document({
level: 0,
},
}),

new Paragraph({
text: "Custom Bullet points",
heading: HeadingLevel.HEADING_1,
Expand Down
31 changes: 31 additions & 0 deletions docs/usage/numbering.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,37 @@ new Paragraph({
}),
```

### Numbering options

Along with `reference` and `level`, the `numbering` object supports an optional `instance` property:

| Property | Type | Notes |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| reference | `string` | The numbering style reference, must match a defined config |
| level | `number` | The list level (0 = top-level, 1 = sub-list, etc.) |
| instance | `number` | *(Optional)* Identifies the instance of the list. Lists with the same `instance` (or none) continue numbering across paragraphs. A new `instance` value restarts numbering from `1`. |

Example:

```ts
new Paragraph({
text: "First list item",
numbering: { reference: "my-numbering", level: 0, instance: 1 },
});

new Paragraph({
text: "Second list item",
numbering: { reference: "my-numbering", level: 0, instance: 1 },
});

new Paragraph({
text: "New list, starts again at 1",
numbering: { reference: "my-numbering", level: 0, instance: 2 },
});
```



## Un-ordered lists / Bullet points

Add a `numbering` section to the `Document` to numbering style, define your levels. Use `LevelFormat.BULLET` for the `format` in `levels`:
Expand Down
Loading