MCPcopy Create free account
hub / github.com/chokcoco/iCSS / getLanguage

Function getLanguage

website/app/components/CodeBlock.tsx:123–167  ·  view source on GitHub ↗
(lang: string)

Source from the content-addressed store, hash-verified

121
122 // 语言映射,确保正确的语法高亮
123 const getLanguage = (lang: string) => {
124 const languageMap: { [key: string]: string } = {
125 'html': 'markup',
126 'htm': 'markup',
127 'xml': 'markup',
128 'css': 'css',
129 'scss': 'scss',
130 'sass': 'sass',
131 'less': 'less',
132 'js': 'javascript',
133 'javascript': 'javascript',
134 'ts': 'typescript',
135 'typescript': 'typescript',
136 'jsx': 'jsx',
137 'tsx': 'tsx',
138 'json': 'json',
139 'bash': 'bash',
140 'shell': 'bash',
141 'sh': 'bash',
142 'python': 'python',
143 'py': 'python',
144 'java': 'java',
145 'c': 'c',
146 'cpp': 'cpp',
147 'c++': 'cpp',
148 'c#': 'csharp',
149 'csharp': 'csharp',
150 'php': 'php',
151 'ruby': 'ruby',
152 'rb': 'ruby',
153 'go': 'go',
154 'rust': 'rust',
155 'rs': 'rust',
156 'sql': 'sql',
157 'yaml': 'yaml',
158 'yml': 'yaml',
159 'toml': 'toml',
160 'ini': 'ini',
161 'conf': 'ini',
162 'diff': 'diff',
163 'git': 'git',
164 };
165
166 return languageMap[lang.toLowerCase()] || lang.toLowerCase();
167 };
168
169 return (
170 <div className="my-4">

Callers 1

CodeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected