char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
59778f019
char/aliceai-t5-moe
1/** 2* Maps file extensions to highlight.js language identifiers 3*/ 4export function getLanguageFromFilename ( filename :string ) :string { 5const extension = filename . toLowerCase (). substring ( filename . lastIndexOf ( '.' )); 6 7switch ( extension ) { 8// JavaScript / TypeScript 9case '.js' : 10case '.mjs' : 11case '.cjs' : 12return 'javascript' ; 13case '.ts' : 14case '.mts' : 15case '.cts' : 16return 'typescript' ; 17case '.jsx' : 18return 'javascript' ; 19case '.tsx' : 20return 'typescript' ; 21 22// Web 23case '.html' : 24case '.htm' : 25return 'html' ; 26case '.css' : 27return 'css' ; 28case '.scss' : 29return 'scss' ; 30case '.less' : 31return 'less' ; 32case '.vue' : 33return 'html' ; 34case '.svelte' : 35return 'html' ; 36 37// Data formats 38case '.json' : 39return 'json' ; 40case '.xml' : 41return 'xml' ; 42case '.yaml' : 43case '.yml' : 44return 'yaml' ; 45case '.toml' : 46return 'ini' ; 47case '.csv' : 48return 'plaintext' ; 49 50// Programming languages 51case '.py' : 52return 'python' ; 53case '.java' : 54return 'java' ; 55case '.kt' : 56case '.kts' : 57return 'kotlin' ; 58case '.scala' : 59return 'scala' ; 60case '.cpp' : 61case '.cc' : 62case '.cxx' : 63case '.c++' : 64return 'cpp' ; 65case '.c' : 66return 'c' ; 67case '.h' : 68case '.hpp' : 69return 'cpp' ; 70case '.cs' : 71return 'csharp' ; 72case '.go' : 73return 'go' ; 74case '.rs' : 75return 'rust' ; 76case '.rb' : 77return 'ruby' ; 78case '.php' : 79return 'php' ; 80case '.swift' : 81return 'swift' ; 82case '.dart' : 83return 'dart' ; 84case '.r' : 85return 'r' ; 86case '.lua' : 87return 'lua' ; 88case '.pl' : 89case '.pm' : 90return 'perl' ; 91 92// Shell 93case '.sh' : 94case '.bash' : 95case '.zsh' : 96return 'bash' ; 97case '.bat' : 98case '.cmd' : 99return 'dos' ; 100case '.ps1' : 101return 'powershell' ; 102 103// Database 104case '.sql' : 105return 'sql' ; 106 107// Markup / Documentation 108case '.md' : 109case '.markdown' : 110return 'markdown' ; 111case '.tex' : 112case '.latex' : 113return 'latex' ; 114case '.adoc' : 115case '.asciidoc' : 116return 'asciidoc' ; 117 118// Config 119case '.ini' : 120case '.cfg' : 121case '.conf' : 122return 'ini' ; 123case '.dockerfile' : 124return 'dockerfile' ; 125case '.nginx' : 126return 'nginx' ; 127 128// Other 129case '.graphql' : 130case '.gql' : 131return 'graphql' ; 132case '.proto' : 133return 'protobuf' ; 134case '.diff' : 135case '.patch' : 136return 'diff' ; 137case '.log' : 138return 'plaintext' ; 139case '.txt' : 140return 'plaintext' ; 141 142default : 143return 'plaintext' ; 144} 145}