edamame 0.1.6

A Terminal Markdown editor that stays rendered while you edit
Documentation
1
2
3
4
5
6
7
8
9
# Footnote reference markers

> Part of the edamame contributor deep-dives. Index and project-wide conventions: [`AGENTS.md`](../../AGENTS.md). Sibling docs live in [`docs/dev/`](.).


- **The marker is plain ASCII: `renderer::reference_marker` renders `[^label]` as `[label]`.** Superscript (`⁽¹⁾`, U+207D/U+207E) is missing from most monospace fonts, and a proportional fallback draws the parenthesis wider than the cell (terminals then shrink or clip it differently, so it looks terminal-specific when it is font-specific). The superscript digits carried a second problem: `¹²³⁴` are East Asian Width **Ambiguous** while `⁰⁵⁶⁷⁸⁹` are Neutral, so a terminal treating ambiguous as wide measured footnotes 1–4 a column wider than edamame did. A marker glyph outside Basic Latin must be justified against font coverage *and* width class (`footnote_marker_is_plain_ascii`).
- **Adjacent references fuse into one marker, and three places must agree on how.** `[^1][^2]` renders `[1,2]`. `renderer::footnote_run_at` is the single derivation; `render_inlines` and `rendered_inlines_width` both consume it so painted marker and measured width can't drift, and `render_paragraph` splits at breaks and calls back through `render_inlines` rather than walking inlines itself. "Adjacent" means adjacent *inlines*, so `[^1] [^2]` stays two markers.
- **`InlineColMap` collapses a fused run by two chars per abutting reference, not one.** A lone `[^1]` → `[1]` differs by exactly the dropped `^` (hence `collapse_footnote_refs` being a single `retain`); a fused run additionally drops the second reference's `[`, and the entry surviving at that position is the *previous* reference's `]`, which becomes the rendered comma. Drop only the carets and the map runs one column long per fused pair, so every selection projection and click past it lands short (`adjacent_footnote_references_collapse_into_one_marker`, `click_inside_a_fused_marker_follows_the_label_clicked`).