concepts
Code References
Labeled line ranges you can embed in any documentation.
A code reference is a named pointer to an exact range of lines in a file. Once created, you embed it in any documentation using the {{label}} syntax - and clicking the chip jumps you straight to those lines.
Anatomy of a reference
A reference has:
| Field | Example |
|---|---|
| Label | password-validation |
| File | backend/app/auth.py |
| Line range | 42 – 60 |
| Color | one of 8 preset colors |
| Created at commit | abc123... |
The label is unique per project. The same label in different projects refers to different code.
Creating a reference
In the code panel:
- Click a line number to start a selection.
- Shift+click another line number to extend the range.
- Open the Code references panel on the right.
- Click Create reference.
- Provide a label and pick a color.
- Click Save.
Embedding in docs
Anywhere in the documentation editor (Visual or Markdown mode):
- Type
{{ - Pick a reference from the autocomplete popup
- Glyph inserts
{{password-validation}} - The chip renders inline with the reference's color
Navigating from a chip
In the rendered documentation:
- Click - scrolls the code panel to the referenced lines and highlights them briefly
- Ctrl/Cmd+Click - opens the referenced file in a new view (useful when the reference points to a different file)
Missing references
If a reference is renamed or deleted, any existing {{old-label}} becomes a red strike-through chip marked as missing. To fix:
- Edit the chip text to match the new label
- Or delete the missing chip and re-insert the new reference
Time travel
References are commit-aware. A reference created on commit abc123 is visible:
- When viewing the file at commit
abc123or any later commit (until deleted) - In documentation written at any of those commits
If lines 42-60 got refactored away in a later commit, the reference still exists but its line range no longer makes sense. Glyph doesn't auto-update references - you can either edit the range or delete and recreate.
Best practice: prefer references to small, stable units (a function, a class, a config block). Avoid referencing implementation details that churn frequently.
Searching references
The references panel for the current file lists every reference in that file. Search across all references in the project from the global search.
📸 Screenshot
Code references panel listing every reference in the project