mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-05 12:16:53 +02:00
Auto-detect language only if enabled and only for codeblocks
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
829169ec87
commit
cd125506b6
@ -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-
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user