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

Commit

Permalink
Merge pull request #6350 from SimonBrandner/fix/dont-auto-detect-lang…
Browse files Browse the repository at this point in the history
…/12366

Don't autodetect language in inline code blocks
  • Loading branch information
germain-gg authored Jul 12, 2021
2 parents 8a816bb + cd12550 commit ebd64eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/views/messages/TextualBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ export default class TextualBody extends React.Component<IProps, IState> {
}

private highlightCode(code: HTMLElement): void {
if (SettingsStore.getValue("enableSyntaxHighlightLanguageDetection")) {
// Auto-detect language only if enabled and only for codeblocks
if (
SettingsStore.getValue("enableSyntaxHighlightLanguageDetection") &&
code.parentElement instanceof HTMLPreElement
) {
highlight.highlightBlock(code);
} else {
// Only syntax highlight if there's a class starting with language-
Expand Down

0 comments on commit ebd64eb

Please sign in to comment.