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

Commit

Permalink
Disallow inline display maths
Browse files Browse the repository at this point in the history
  • Loading branch information
rda0 committed Apr 28, 2021
1 parent 4554124 commit bbce1ac
Showing 1 changed file with 4 additions and 4 deletions.
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": "(^)\\$\\$(([^$]|\\\\\\$)+?)\\$\\$$",

// 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

0 comments on commit bbce1ac

Please sign in to comment.