Skip to content

Project footnote-reference source in the editor #60

Description

@Azganoth

Summary

Project footnote-reference Markdown source through the generalized source-projection session engine in #63.

When the caret enters a footnote reference, Leafdown should temporarily expose its Markdown source, such as [^note], as editable text in the ProseMirror document. Valid source commits back to Milkdown’s canonical footnote-reference node; invalid source becomes exact literal text.

This issue depends on #63 and is independent of #58. It adds the atomic-node adapter after the shared engine exists, without reintroducing a detached input.

Expected behavior

  • A caret entering a footnote reference exposes its complete [^label] source directly in the editor.
  • Projected source is real editable document text, not a focused input widget or decoration-only surface.
  • Entering from the left maps the caret to the beginning of the projected source; entering from the right maps it to the end.
  • If native pointer interaction produces a node selection for the atomic reference, projection activates with the label text selected.
  • Editing valid source commits to the corresponding canonical footnote-reference node when the session finalizes.
  • Invalid or incomplete source finalizes as exact literal text without content loss.
  • Caret movement, selections crossing the projected reference boundary, target switching, projection-local and native undo/redo, dirty state, and save-time serialization behave consistently with existing source projection.
  • Editing a reference label does not implicitly create, rename, delete, or modify a footnote definition.
  • Footnote definitions retain their current editable block presentation.

Related docs

Done when

  • Generalize and rename the source-projection session engine #63’s generalized source-projection engine is used through an atomic-node adapter.
  • Entering a footnote reference starts an in-document source-projection session for its complete [^label] syntax.
  • Entry from the left, entry from the right, and native node-selection activation use the defined source selection mapping.
  • Valid source rehydrates to the canonical Milkdown footnote-reference node.
  • Invalid or incomplete source falls back to exact literal text.
  • Session entry, exit, target switching, selection crossing, undo/redo, dirty tracking, and save-time serialization are covered by focused tests.
  • Editing a reference label leaves all footnote definitions unchanged.
  • The focused footnote-reference input widget path is removed from marker presentation.
  • The specification and Unreleased changelog describe the user-visible behavior.

Out of scope

  • Footnote definitions and their block presentation.
  • Footnote tooltips or definition previews.
  • Navigating to, creating, renaming, or managing footnote definitions.
  • Mixed-format link-label projection.
  • Raw HTML and image source editing.
  • A permanent Markdown-token schema.

Metadata

Metadata

Assignees

Labels

FeatureNew feature or request

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions