Skip to main content

is_supported_language

Function is_supported_language 

Source
pub fn is_supported_language(language: &str) -> bool
Expand description

Names we accept from the editor’s language prop.

The matching is permissive and case-insensitive. Canonical targets are in normalize_language. In particular:

  • rust / rs → Rust
  • typescript / ts → TypeScript
  • javascript / js → JavaScript
  • jsx / tsx → JavaScript (bundle-size fallback; the dedicated tree-sitter-tsx grammar would add ~1 MB uncompressed, so we accept losing JSX tag/attribute granularity and TypeScript type syntax for .tsx snippets)
  • python / py, json, bash / sh / shell / zsh, html / htm, css, markdown / md, sql + dialect aliases → their respective grammars

Returns false for unsupported languages — the caller should fall back to rendering the code unstyled.