Skip to main content

Module code_languages

Module code_languages 

Source
Expand description

Language normalization and metadata for code blocks. Code fence language normalization.

This module exists so both the editor and viewer can share:

  • a small, curated list of common language aliases
  • consistent display labels (e.g. rs -> Rust)

The core renderer also uses this to populate data-language on <pre> so CSS themes can show a proper label instead of a generic “Code”.

Structs§

CodeLanguage
Canonical code-language name plus accepted aliases.

Constants§

KNOWN_CODE_LANGUAGES
A small, human-curated set of common languages and their aliases.

Functions§

canonical_language_name
If raw is a known language (by canonical name or alias), return its canonical name.
language_display_label
Returns a display label for a fenced code language.