Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

1.0 KB
Raw Blame
import type { CodeblockLanguage } from "@/src/components/design-system/Codeblock/Codeblock";

// Grammars and aliases available to Prism in `SyntaxHighlight`.
const supportedLanguages = [
  "plain",
  "plaintext",
  "text",
  "txt",
  "markup",
  "html",
  "mathml",
  "svg",
  "xml",
  "ssml",
  "atom",
  "rss",
  "regex",
  "clike",
  "javascript",
  "js",
  "actionscript",
  "coffeescript",
  "coffee",
  "javadoclike",
  "css",
  "yaml",
  "yml",
  "markdown",
  "md",
  "graphql",
  "sql",
  "typescript",
  "ts",
  "jsdoc",
  "flow",
  "n4js",
  "n4jsd",
  "jsx",
  "tsx",
  "swift",
  "kotlin",
  "kt",
  "kts",
  "c",
  "objectivec",
  "objc",
  "reason",
  "rust",
  "go",
  "cpp",
  "python",
  "py",
  "json",
  "webmanifest",
  "bash",
  "sh",
  "shell",
  "toml",
] as const satisfies readonly CodeblockLanguage[];

export function normalizeCodeblockLanguage(
  language: string,
): CodeblockLanguage {
  return (
    supportedLanguages.find(
      (supported) => supported === language.toLowerCase(),
    ) ?? "text"
  );
}