## Problem description
The implementation of citations is currently closely tied to skins, and not very optimized for working with citations as structured data. New use cases require more structured access to a) all revision content, and b) individual references.
### Use cases
#### Mobile web
The mobile web team would like to speed up page load times by lazily loading references only when the user clicks on a reference link.
Specifically: A reference link inside a superscript tag has a unique identifier and this unique identifier can be used to retrieve the HTML for the reference and render it in a reference drawer:
TODO: @Halfak @kaldari: @Cenarium Add your use cases
- For each revision, support efficient retrieval of
- page content without references, and
- all reference blocks.
- For each revision, support retrieval of individual references.
- Ideally, provide stable identifiers of unmodified references across revisions.
## Possible solutions
Goal: Discuss different options, focusing on trade-offs.
### Stable reference IDs
Current reference ids are based on counters, which makes them inherently unstable between revisions or parser implementations (PHP parser vs. Parsoid). It would be useful to instead use //stable reference ids//, based on something like a hash of the reference wikitext.
- Enables tracking of unmodified reference content across revisions.
- Automatic cache busting for per-reference APIs.
- Can simplify reuse of expanded reference content.
- Makes use of Parsoid reference content from PHP-parser views robust.
- Need to add an additional id attribute, increasing HTML size.
- Cost of calculating hashes.
Potential avenues worth exploring
- Ability to update a reference URL in one place (for example if page A and page B use reference C and reference C link moves to a different url, could potentially be updated in one place)
- Ability to edit references without editing entire page. e.g. fix dead links / use wayback machine for rewrites
- Do we need to continue supporting current numbered reference links long term?