feat: add C, C++, and Java syntax highlighting support

Add c, cpp, and java to the highlight.js language bundle for code block
rendering. These are among the most commonly used languages in AI coding
conversations and were previously unsupported, falling back to plain text.

Also adds aliases: h (C headers), cc/cxx/c++/hpp/hxx (C++ variants).
This commit is contained in:
Nicolas Varrot
2026-02-13 11:30:18 +00:00
parent 6fb2f83716
commit f8324b760c
2 changed files with 14 additions and 4 deletions

View File

@@ -3,8 +3,8 @@ import hljs, { rehypeHighlightLanguages, rehypeHighlightOptions } from '../highl
describe('highlight', () => {
const expectedLanguages = [
'bash', 'css', 'diff', 'dockerfile', 'go', 'ini',
'javascript', 'json', 'markdown', 'python', 'rust',
'bash', 'c', 'cpp', 'css', 'diff', 'dockerfile', 'go', 'ini',
'java', 'javascript', 'json', 'markdown', 'python', 'rust',
'shell', 'sql', 'typescript', 'xml', 'yaml',
];
@@ -17,7 +17,7 @@ describe('highlight', () => {
});
it('resolves common aliases', () => {
const aliases = ['sh', 'zsh', 'js', 'jsx', 'ts', 'tsx', 'py', 'html', 'yml', 'rs'];
const aliases = ['sh', 'zsh', 'h', 'cc', 'cxx', 'js', 'jsx', 'ts', 'tsx', 'py', 'html', 'yml', 'rs'];
for (const alias of aliases) {
const lang = hljs.getLanguage(alias);
expect(lang, `alias "${alias}" should resolve`).toBeDefined();