From 97f6431d60ff5e3f9168948a306036402c316fa1 Mon Sep 17 00:00:00 2001 From: Harnoor Singh Date: Tue, 31 Jan 2023 04:48:34 -0500 Subject: [PATCH] Migrate highlight.js API call in TextualBody (#9923) Co-authored-by: Michael Weimann Fixes https://github.com/vector-im/element-web/issues/22233 --- src/components/views/messages/TextualBody.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.tsx b/src/components/views/messages/TextualBody.tsx index 2bddfcaccf..1679c08f12 100644 --- a/src/components/views/messages/TextualBody.tsx +++ b/src/components/views/messages/TextualBody.tsx @@ -265,7 +265,7 @@ export default class TextualBody extends React.Component { // We don't use highlightElement here because we can't force language detection // off. It should use the one we've found in the CSS class but we'd rather pass // it in explicitly to make sure. - code.innerHTML = highlight.highlight(advertisedLang, code.textContent).value; + code.innerHTML = highlight.highlight(code.textContent, { language: advertisedLang }).value; } else if ( SettingsStore.getValue("enableSyntaxHighlightLanguageDetection") && code.parentElement instanceof HTMLPreElement