feat: Add MATLAB syntax highlighting support for code blocks (#20773)

* feat: Add MATLAB syntax highlighting support for code blocks

Add MATLAB syntax highlighting support by fixing issues in both CodeEditor (editable) and CodeBlock (read-only) components.

Changes:
- CodeEditor.svelte: Added 'matlab' alias to CodeMirror's Octave language (MATLAB-compatible syntax)
- CodeBlock.svelte: Fixed highlight.js usage to use highlight() directly when language is recognized, falling back to highlightAuto() only for unknown languages

* revert: not needed
This commit is contained in:
G30
2026-01-19 04:58:48 -05:00
committed by GitHub
parent be75bc506a
commit 98cb2d3411

View File

@@ -104,6 +104,12 @@
})
);
// Add 'matlab' alias to Octave language (MATLAB-compatible syntax)
const octaveLang = languages.find((l) => l.name === 'Octave');
if (octaveLang && !octaveLang.alias.includes('matlab')) {
octaveLang.alias.push('matlab');
}
const getLang = async () => {
const language = languages.find((l) => l.alias.includes(lang));
return await language?.load();