renderer.getCitedKeys
How to read this API
These are TypeScript APIs compiled into SnapTeX; a .tex project cannot load them at runtime.
function name(...)is a helper that your rule imports and calls.apply(...),render(...),extract(...), andcollect(...)are callbacks that your rule implements and SnapTeX calls.renderer.name(...),context.name(...),input.name(...), anddeps.name(...)are methods SnapTeX supplies to callbacks; do not import or construct them.service.name(...)is an instance method called after your host or test constructsPreviewUpdateService.
Register extension declarations through SNAP_TEX_RULES in src/rules.ts. See Source API Scope for imports, value ownership, output safety, rebuilds, and testing.
Reads citation keys currently registered by the renderer. Use it for bibliography output after citation rules have populated the shared state.
Signature
renderer.getCitedKeys(): readonly string[]Returns
A new read-only array snapshot in first-seen order. Duplicate citation calls do not add duplicate keys.
Call relationships
- Reads state written by:
resolveCitation. - Called by: bibliography and citation-aware rendering rules.
- Does not: sort or mutate renderer citation state.
const cited = renderer.getCitedKeys();
if (cited.length === 0) {
return 'No citations found.';
}Dependency fingerprints use a separate stable deduplicated/sorted representation through deps.citedKeys; this method preserves render order.
Call the method again when current state is required. A previously returned array does not update after later citations are registered.