feat: upgrade marked to v17 with marked-highlight extension

- Update marked from ^16.2.1 to ^17.0.3
- Add marked-highlight ^2.2.3 for syntax highlighting support
- Replace deprecated marked.setOptions() with marked.use() in renderer.js
- Extract highlight config into markedHighlight() extension (required in v17)
- Update test mock to reflect new API (use instead of setOptions)
This commit is contained in:
2026-03-04 15:24:46 +05:30
parent e7eff01db6
commit 824f659e13
3 changed files with 10 additions and 5 deletions
+7 -3
View File
@@ -5,11 +5,12 @@
const { ipcRenderer } = require('electron');
const marked = require('marked');
const { markedHighlight } = require('marked-highlight');
const DOMPurify = require('dompurify');
const hljs = require('highlight.js');
// Configure marked
marked.setOptions({
// Configure marked with highlight extension
marked.use(markedHighlight({
highlight: function(code, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
@@ -19,7 +20,10 @@ marked.setOptions({
}
}
return hljs.highlightAuto(code).value;
},
}
}));
marked.use({
breaks: true,
gfm: true
});