Skip to content

Name Sanitization

All user-provided names (theme, entities, colors, modes) are sanitized before being used in Figma variable paths and collection names. The sanitizeName() function applies these transformations:

  1. Cyrillic transliteration -- аa, бb, жzh, щsch, etc. Full Russian alphabet supported.
  2. Lowercase -- "My Surface""my surface"
  3. Spaces → hyphens -- "my surface""my-surface"
  4. Remove invalid characters -- only a-z, 0-9, -, _, / survive
  5. Collapse hyphens -- "a---b""a-b"
  6. Trim hyphens -- no leading/trailing hyphens

Examples:

InputSanitized
"Surfaces"surfaces
"Content on Layers"content-on-layers
"Фон (основной)"fon-osnovnoy
"UI / Brand"ui/brand
"--Hello World--"hello-world

Duplicate detection also uses sanitizeName() -- two names that sanitize to the same string are flagged as duplicates (e.g., "My Color" and "my-color").


All rights reserved.