Footnote

Academic-style footnotes with citations.

Try this feature โ†’

Import

typescript
import { footnotePlugin } from 'halka/plugins/footnote';

Usage

  • Add footnote bodies with footnote.addItem
  • Insert citation at cursor โ€” auto-numbered superscript
  • Read footnote.items state to build a footnote manager UI
  • See /docs/svelte-ui for the in-repo FootnoteManager component

Commands

CommandDescription
footnote.addItemAdd footnote HTML
footnote.insertCitationInsert citation at cursor
footnote.editItem / footnote.removeItemEdit or remove

State

Read plugin state with editor.getState(name). Listen to formatChange to refresh UI when the selection moves.

StateDescription
footnote.itemsArray of { id, content }
typescript
const items = editor.getState('footnote.items') as {
  id: string;
  content: string;
}[];

// Build a footnote manager UI from items
for (const item of items) {
  console.log(item.id, item.content);
}

editor.on('formatChange', () => {
  const footnotes = editor.getState('footnote.items');
});

Example

typescript
editor.execCommand('footnote.addItem', '<p>Source note.</p>');
const items = editor.getState('footnote.items');
editor.execCommand('footnote.insertCitation', items[0].id);

MIT ยท Halka Editor