Footnotes & endnotes
Footnotes and endnotes attach numbered reference stories to any position in body prose. Footnotes render at the bottom of the physical page containing their reference marker; endnotes collect at the end of the document. Both are full editable rich-text stories with live automatic renumbering.
- Included in:
documentConfiguration(opt-in viaFootnote.element/Endnote.element) - Pure-Dart import:
package:vyuh_document_elements/notes.dartorpackage:vyuh_document_elements/vyuh_document_elements.dart - Actions:
DocumentActions.insertFootnote,DocumentActions.insertEndnote
Quick example
dart
import 'package:vyuh_document/vyuh_document.dart';
import 'package:vyuh_document_elements/vyuh_document_elements.dart';
final controller = DocumentController(
documentConfiguration,
document: Document.of(documentConfiguration, [
Paragraph('Quarterly revenue rose 24% year over year.'),
]),
);
// Insert a footnote at the current caret position
controller.execute(
InsertFootnote(
blocks: [Paragraph('Audited figures per Q4 filing.')],
),
);
// Address existing footnotes and endnotes canonically
final footnotes = controller.document.footnotes; // List<FootnoteAddress>
final endnotes = controller.document.endnotes; // List<EndnoteAddress>What you can configure
| Capability | API | Purpose |
|---|---|---|
| Footnote insertion | InsertFootnote(blocks:) / controller.insertFootnote(blocks:) | Inserts an inline superscript marker and creates the matching bottom-of-page story |
| Endnote insertion | InsertEndnote(blocks:) / controller.insertEndnote(blocks:) | Inserts an inline marker and creates the matching end-of-document story |
| Canonical addressing | FootnoteAddress (doc.footnotes), EndnoteAddress (doc.endnotes) | Address, inspect, edit, or delete any note story independently of visual page breaks |
| Auto-numbering | Engine & layout resolver | Automatically renumbers all markers in document order when notes are inserted, moved, or deleted |
| Rich note content | List<DocumentBlock> | Note bodies support formatted paragraphs, links, inline code, and marks |
Actions & commands
| Action ID | Effect |
|---|---|
DocumentActions.insertFootnote | Inserts a new footnote at the active caret and moves focus into its note body |
DocumentActions.insertEndnote | Inserts a new endnote at the active caret and moves focus into its note body |
Deleting a reference marker in the main body automatically removes its owned note story and updates history atomically (undo restores both marker and story).
Restricting usage
- Remove footnotes/endnotes: Start from
notesConfiguration(which omits them) or derive:
dart
final noNotes = documentConfiguration.withoutElements([
Footnote.element,
Endnote.element,
]);- Allow footnotes only (disable endnotes): Exclude
Endnote.elementor gateDocumentActions.insertEndnoteinDocumentPolicy.
Format parity
| DOCX | HTML | Markdown | |
|---|---|---|---|
Native word/footnotes.xml and word/endnotes.xml with full round-trip | Footnotes pinned to the bottom of their reference page; endnotes at document end | Semantic <section role="doc-endnotes"> with linked back-references | GFM footnote syntax ([^1] + definition) |