Skip to content

Commit 98cb2d3

Browse files
authored
feat: Add MATLAB syntax highlighting support for code blocks (open-webui#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
1 parent be75bc5 commit 98cb2d3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/lib/components/common/CodeEditor.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@
104104
})
105105
);
106106
107+
// Add 'matlab' alias to Octave language (MATLAB-compatible syntax)
108+
const octaveLang = languages.find((l) => l.name === 'Octave');
109+
if (octaveLang && !octaveLang.alias.includes('matlab')) {
110+
octaveLang.alias.push('matlab');
111+
}
112+
107113
const getLang = async () => {
108114
const language = languages.find((l) => l.alias.includes(lang));
109115
return await language?.load();

0 commit comments

Comments
 (0)