# Footnotes and endnotes

- Human documentation: [https://docs.univer.ai/guides/docs/features/footnotes](https://docs.univer.ai/guides/docs/features/footnotes)

- Agent Markdown: [https://docs.univer.ai/guides/docs/features/footnotes.md](https://docs.univer.ai/guides/docs/features/footnotes.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [docs/features/footnotes.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/docs/features/footnotes.mdx)

---

#### Package metadata

```json
{
  "preset": [
    {
      "client": "@univerjs/preset-docs-advanced",
      "locale": "@univerjs/preset-docs-advanced/locales/en-US",
      "style": "@univerjs/preset-docs-advanced/lib/index.css"
    }
  ],
  "plugins": [
    {
      "client": "@univerjs-pro/docs-reference",
      "facade": "@univerjs-pro/docs-reference/facade"
    },
    {
      "client": "@univerjs-pro/docs-reference-ui",
      "locale": "@univerjs-pro/docs-reference-ui/locale/en-US",
      "style": "@univerjs-pro/docs-reference-ui/lib/index.css"
    }
  ],
  "server": false
}
```

Add footnotes and endnotes to traditional, paginated documents. A footnote is laid out on its reference page; an endnote is placed according to the document’s endnote settings. Modern documents are not supported by this API.

## Installation

Add these plugins to an existing Docs editor with a configured license. Load the UI styles and the locale matching the editor.

`UniverDocsAdvancedPreset` already includes both plugins. When using that preset, keep its registration instead of adding the plugins again.

#### npm

```bash
npm install @univerjs-pro/docs-reference @univerjs-pro/docs-reference-ui
```

#### pnpm

```bash
pnpm add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-ui
```

#### yarn

```bash
yarn add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-ui
```

#### bun

```bash
bun add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-ui
```

```ts
import { UniverDocsReferencePlugin } from '@univerjs-pro/docs-reference'
import { UniverDocsReferenceUIPlugin } from '@univerjs-pro/docs-reference-ui'
import ReferenceLocale from '@univerjs-pro/docs-reference-ui/locale/en-US'
import { LocaleType } from '@univerjs/core'

import '@univerjs-pro/docs-reference/facade'
import '@univerjs-pro/docs-reference-ui/lib/index.css'

univerAPI.loadLocales(LocaleType.EN_US, ReferenceLocale)
univer.registerPlugin(UniverDocsReferencePlugin)
univer.registerPlugin(UniverDocsReferenceUIPlugin)
```

## Insert and manage notes

```ts
const document = univerAPI.getActiveDocument()
if (document) {
  const noteId = document.insertFootnote(0)
  if (noteId) console.log(document.getParagraphs(noteId))
  console.log(document.getFootnotes(), document.getEndnotes())
}
```

The offset is a UTF-16 position in the main body, including structural tokens. An invalid position, invalid note content, insufficient permission, or a modern document makes insertion return `null`. A successful insertion returns a stable note ID. The reference and note content participate in the same undo and collaboration mutation.

Use `getFootnotes()` / `getEndnotes()` to read notes and `deleteFootnote(noteId)` / `deleteEndnote(noteId)` to remove them. `setFootnoteSettings()` and `setEndnoteSettings()` configure numbering and placement; passing `null` resets explicit settings. Keep the returned note ID for addressing content; displayed numbers can change after pagination.
