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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user