GGlyphDocs

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:

FieldExample
Labelpassword-validation
Filebackend/app/auth.py
Line range42 – 60
Colorone of 8 preset colors
Created at commitabc123...

The label is unique per project. The same label in different projects refers to different code.

Creating a reference

In the code panel:

  1. Click a line number to start a selection.
  2. Shift+click another line number to extend the range.
  3. Open the Code references panel on the right.
  4. Click Create reference.
  5. Provide a label and pick a color.
  6. 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

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 abc123 or 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