1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-07 10:46:24 +03:00

math off by default, enable with latex_maths flag

This commit is contained in:
Aleks Kissinger
2020-09-20 15:07:12 +01:00
parent e78734bbf6
commit 428a6b94ff
2 changed files with 5 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import EMOJIBASE_REGEX from 'emojibase-regex';
import url from 'url';
import katex from 'katex';
import { AllHtmlEntities } from 'html-entities';
import SdkConfig from './SdkConfig';
import {MatrixClientPeg} from './MatrixClientPeg';
import {tryTransformPermalinkToLocalHref} from "./utils/permalinks/Permalinks";
@@ -50,6 +51,7 @@ const ZWJ_REGEX = new RegExp("\u200D|\u2003", "g");
// Regex pattern for whitespace characters
const WHITESPACE_REGEX = new RegExp("\\s", "g");
const BIGEMOJI_REGEX = new RegExp(`^(${EMOJIBASE_REGEX.source})+$`, 'i');
const COLOR_REGEX = /^#[0-9a-fA-F]{6}$/;
@@ -411,7 +413,7 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
if (isHtmlMessage) {
isDisplayedWithHtml = true;
safeBody = sanitizeHtml(formattedBody, sanitizeParams);
if (true) { // TODO: add katex setting
if (SdkConfig.get()['latex_maths']) {
const mathDelimiters = [
{ left: "<div data-mx-maths=\"", right: "\">.*?</div>", display: true },
{ left: "<span data-mx-maths=\"", right: "\">.*?</span>", display: false }