apps/chat/src/utils/app/codeblock.ts (242 lines of code) (raw):

type languageMap = Record<string, string | undefined>; export const languageExtensionMapping: languageMap = { 'avro-idl': '.avdl', 'objective-c': '.m', 'solution-file': '.sln', 'splunk-spl': '.spl', 't4-cs': '.tt', 't4-vb': '.tt', 'web-idl': '.webidl', abap: '.abap', abnf: '.abnf', actionscript: '.as', ada: '.ada', agda: '.agda', al: '.al', antlr4: '.g4', apex: '.cls', applescript: '.applescript', aql: '.aql', arduino: '.ino', arff: '.arff', asciidoc: '.adoc', asm6502: '.asm', asmatmel: '.asm', aspnet: '.aspx', autohotkey: '.ahk', autoit: '.au3', avisynth: '.avs', bash: '.sh', basic: '.bas', batch: '.bat', bicep: '.bicep', birb: '.birb', bison: '.y', bnf: '.bnf', brainfuck: '.bf', brightscript: '.brs', bro: '.bro', bsl: '.bsl', c: '.c', cfscript: '.cfc', chaiscript: '.chai', cil: '.il', clojure: '.clj', cmake: '.cmake', cobol: '.cob', coffeescript: '.coffee', concurnas: '.conc', coq: '.v', cpp: '.cpp', crystal: '.cr', csharp: '.cs', cshtml: '.cshtml', csp: '.csp', css: '.css', csv: '.csv', cypher: '.cql', d: '.d', dart: '.dart', dataweave: '.dwl', dax: '.dax', dhall: '.dhall', diff: '.diff', dot: '.dot', ebnf: '.ebnf', eiffel: '.e', ejs: '.ejs', elixir: '.ex', elm: '.elm', erb: '.erb', erlang: '.erl', etlua: '.etl', factor: '.factor', fortran: '.f90', fsharp: '.fs', ftl: '.ftl', gap: '.g', gcode: '.gcode', gdscript: '.gd', gedcom: '.ged', gherkin: '.feature', glsl: '.glsl', gml: '.gml', gn: '.gn', go: '.go', graphql: '.graphql', groovy: '.groovy', haml: '.haml', handlebars: '.hbs', haskell: '.hs', haxe: '.hx', hcl: '.hcl', hlsl: '.hlsl', hoon: '.hoon', html: '.html', ichigojam: '.ijs', icon: '.icn', idris: '.idr', iecst: '.st', inform7: '.ni', ini: '.ini', io: '.io', j: '.ijs', java: '.java', javascript: '.js', jexl: '.jexl', jolie: '.iol', jq: '.jq', json: '.json', json5: '.json5', jsx: '.jsx', julia: '.jl', keyman: '.kmn', kotlin: '.kt', kumir: '.kum', kusto: '.kql', latte: '.latte', less: '.less', lilypond: '.ly', liquid: '.liquid', lisp: '.lisp', livescript: '.ls', llvm: '.ll', lolcode: '.lol', lua: '.lua', magma: '.magma', markdown: '.md', matlab: '.m', maxscript: '.ms', mel: '.mel', mermaid: '.mmd', mizar: '.miz', monkey: '.monkey', moonscript: '.moon', n1ql: '.n1ql', n4js: '.n4js', naniscript: '.nani', nasm: '.asm', neon: '.neon', nevod: '.nevod', nginx: '.conf', nim: '.nim', nix: '.nix', nsis: '.nsi', ocaml: '.ml', opencl: '.cl', openqasm: '.qasm', oz: '.oz', parigp: '.gp', pascal: '.pas', pascaligo: '.ligo', patch: '.patch', pcaxis: '.px', peoplecode: '.pcode', perl: '.pl', php: '.php', plsql: '.pls', powerquery: '.pq', powershell: '.ps1', processing: '.pde', prolog: '.pl', promql: '.promql', properties: '.properties', protobuf: '.proto', psl: '.psl', pug: '.pug', puppet: '.pp', pure: '.pure', purebasic: '.pb', purescript: '.purs', python: '.py', q: '.q', qml: '.qml', qore: '.q', qsharp: '.qs', r: '.r', racket: '.rkt', reason: '.re', rego: '.rego', renpy: '.rpy', rest: '.rest', rip: '.rip', roboconf: '.graph', robotframework: '.robot', ruby: '.rb', rust: '.rs', sas: '.sas', sass: '.sass', scala: '.scala', scheme: '.scm', scss: '.scss', shell: '.sh', smali: '.smali', smalltalk: '.st', smarty: '.tpl', sml: '.sml', solidity: '.sol', soy: '.soy', sparql: '.rq', sqf: '.sqf', sql: '.sql', squirrel: '.nut', stan: '.stan', stylus: '.styl', swift: '.swift', tap: '.tap', tcl: '.tcl', tex: '.tex', textile: '.textile', toml: '.toml', tremor: '.tremor', tsx: '.tsx', tt2: '.tt2', turtle: '.ttl', twig: '.twig', typescript: '.ts', typoscript: '.typoscript', unrealscript: '.uc', uorazor: '.cshtml', v: '.v', vala: '.vala', vbnet: '.vb', velocity: '.vm', verilog: '.v', vhdl: '.vhd', vim: '.vim', warpscript: '.mc2', webassembly: '.wat', xml: '.xml', xojo: '.xojo_code', xquery: '.xq', yaml: '.yaml', yang: '.yang', zig: '.zig', // Aligned with supported languages in prism // src: https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/src/languages/prism/supported-languages.js }; export const languageNameMapping: languageMap = { sh: 'bash', // Treat shell scripts as bash scripts }; export const languageFilenameMapping: languageMap = { dockerfile: 'Dockerfile', makefile: 'Makefile', // Add other specific filenames here };