Citations That Behave Like Citations
A run of the multi-source research template produced a good report about investment instruments, and then printed it badly. Ninety-five markers of the form ^1 sat inline in the prose, and nine lines beginning ^1 : sat in…
A run of the multi-source research template produced a good report about investment instruments, and then printed it badly. Ninety-five markers of the form [^1] sat inline in the prose, and nine lines beginning [^1]: sat in a heap under the text. On the web and on the phone alike.
The cause is that footnotes are not part of markdown. They are an extension, and neither of the two markdown renderers we ship — one on the web, a different one on mobile — implements it. We were asking the model for exactly that shape and then rendering it as literal text.
One rewriter, two engines
Rather than teach two renderers the same extension, the markers are rewritten before either of them sees the text, into a plain link that both already render identically. The definitions are lifted out and returned separately, and whatever followed them stays as the tail of the document. The brackets stay inside the link text, so stacked citations read [1][2] and not 12.
On the web the citation is drawn as a superscript, the definitions render as a list with real anchors, clicking one scrolls to it and flashes the row, and the number in the list jumps back to the first place it was cited. Hovering shows the definition without moving. On the phone the same markers are drawn in the accent colour and tapping one scrolls the pane to the matching row. Links that are not citations keep opening in a browser, as before.
The source cards below a report were never affected — they come from somewhere else and were always fine.
And in the download
A report you download as .docx, .pdf or .md went through a different converter, which printed the raw markers straight into the document. A document spec has no superscript, so a citation prints as [3] and each definition opens its own line beginning [3]. Indented continuation lines join their definition. The numbers in the file are the numbers on the screen.
The first attempt was wrong in a way we had a guard for
The first version made the footnote numbers ordinary fragment links — href="#fn-3". Under the <base href="/"> that a single-page app needs, a bare fragment resolves against the site root, so the link points at the homepage. The click handler cancelled the navigation, so it worked; it would have kept working until someone touched the handler.
A check we already had for precisely this pattern went red on the local run before the push. The numbers are buttons now, which scroll, move focus, and respect a reader's preference for reduced motion.