Expand description
GitHub Linguist language data
Auto-generated from GitHub Linguist languages.yml Linguist commit: e51c2270 (2026-01-14)
The KNOWN_EXTENSIONS set is generated by the committed
scripts/gen_linguist_extensions.py from the same pinned languages.yml.
The alias maps predate that script; their generator was not committed, so
regenerating them means rewriting it (and folding the manual additions
below back in or bumping the pin past them).
Manual addition on top of the e51c2270 generation: py and py3 as aliases
for Python in both ALIAS_TO_CANONICAL and CANONICAL_TO_ALIASES. Upstream
added these in commit 6fc1cc65b3 (“Add py and py3 to Python aliases”,
PR #7791, merged 2026-03-02), after the e51c2270 pin (2026-01-14), so a
regeneration from that pinned commit alone would not include them.
Constants§
- LINGUIST_
DATE - Linguist commit date
- LINGUIST_
VERSION - Linguist commit hash this data was generated from
Statics§
- ALIAS_
TO_ CANONICAL - Maps lowercase alias -> canonical language name
- CANONICAL_
TO_ ALIASES - Maps canonical language name -> all valid aliases (for validation)
- DEFAULT_
ALIASES - Preferred default alias for common languages (curated for widespread usage)
- KNOWN_
EXTENSIONS - File extensions (lowercased, leading dot stripped) of every Linguist
language. GitHub resolves fenced-code labels against names, aliases, AND
extensions (```pytb highlights via Python traceback’s
.pytbextension, with no such alias existing), so “is this label known” must consult this set. Extensions are deliberately NOT resolvable to a canonical language: many are ambiguous across languages (.plis Perl and Prolog), so they participate in existence checks only, never in label rewriting.
Functions§
- default_
alias - Get the preferred default alias for a language
- get_
aliases - Get all valid aliases for a canonical language
- is_
known_ language - Whether GitHub recognizes
labelas a fenced-code-block language: a language name, an alias, or a file extension. This is the accept-set for “unknown language” checks. It is intentionally broader thanresolve_canonical, which answers the different question “which language is this” and must stay alias-only: extension labels likepytbare known (GitHub highlights them) but have no canonical resolution safe enough to rewrite or route on. - is_
valid_ alias - Check if an alias is valid for a canonical language
- resolve_
canonical - Resolve an alias to its canonical language name