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

Disallow inline display maths #5939

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/editor/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export function htmlSerializeIfNeeded(model: EditorModel, {forceHTML = false} =
// const inlinePattern = "(?:^|\\s)(?<!\\\\)\\$(?!\\s)(([^$]|\\\\\\$)+?)(?<!\\\\|\\s)\\$";

// conditions for display math detection $$...$$:
// - pattern starts at beginning of line or is not prefixed with backslash or dollar
// - pattern starts and ends on a new line
// - left delimiter ($$) is not escaped by backslash
"display": "(^|[^\\\\$])\\$\\$(([^$]|\\\\\\$)+?)\\$\\$",
"display": "(^)\\$\\$(([^$]|\\\\\\$)+?)\\$\\$$",
uhoreg marked this conversation as resolved.
Show resolved Hide resolved

// conditions for inline math detection $...$:
// - pattern starts at beginning of line, follows whitespace character or punctuation
Expand All @@ -78,9 +78,9 @@ export function htmlSerializeIfNeeded(model: EditorModel, {forceHTML = false} =
// detect math with latex delimiters, inline: \(...\), display \[...\]

// conditions for display math detection \[...\]:
// - pattern starts at beginning of line or is not prefixed with backslash
// - pattern starts and ends on a new line
// - pattern is not empty
"display": "(^|[^\\\\])\\\\\\[(?!\\\\\\])(.*?)\\\\\\]",
"display": "(^)\\\\\\[(?!\\\\\\])(.*?)\\\\\\]$",

// conditions for inline math detection \(...\):
// - pattern starts at beginning of line or is not prefixed with backslash
Expand Down