Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ebd64eb

Browse files
authored
Merge pull request #6350 from SimonBrandner/fix/dont-auto-detect-lang/12366
Don't autodetect language in inline code blocks
2 parents 8a816bb + cd12550 commit ebd64eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/views/messages/TextualBody.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ export default class TextualBody extends React.Component<IProps, IState> {
244244
}
245245

246246
private highlightCode(code: HTMLElement): void {
247-
if (SettingsStore.getValue("enableSyntaxHighlightLanguageDetection")) {
247+
// Auto-detect language only if enabled and only for codeblocks
248+
if (
249+
SettingsStore.getValue("enableSyntaxHighlightLanguageDetection") &&
250+
code.parentElement instanceof HTMLPreElement
251+
) {
248252
highlight.highlightBlock(code);
249253
} else {
250254
// Only syntax highlight if there's a class starting with language-

0 commit comments

Comments
 (0)