fix: Adjust math delimiter to fix markdown import/export compatibility issue (#6727)

#6650)
This commit is contained in:
bLue authored and GitHub committed 2024-09-28 12:45:03 -07:00
1 parent b6e43e1990
commit 3f73c9d2bf
3 files changed
+7 -7

No files matched your search

+2 -2
View File
@@ -69,9 +69,9 @@ export default class Math extends Node {
}
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
state.write("$$");
state.write("$");
state.text(node.textContent, false);
state.write("$$");
state.write("$");
}
parseMarkdown() {
+2 -2
View File
@@ -41,10 +41,10 @@ export default class MathBlock extends Node {
}
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
state.write("$$$\n");
state.write("$$\n");
state.text(node.textContent, false);
state.ensureNewLine();
state.write("$$$");
state.write("$$");
state.closeBlock(node);
}
+3 -3
View File
@@ -6,8 +6,8 @@ export const REGEX_INLINE_MATH_DOLLARS = /\$\$(.+)\$\$/;
export const REGEX_BLOCK_MATH_DOLLARS = /\$\$\$\s+$/;
const inlineMathDelimiter = "$$";
const blockMathDelimiter = "$$$";
const inlineMathDelimiter = "$";
const blockMathDelimiter = "$$";
// test if potential opening or closing delimiter
// assumes that there is a "$" at state.src[pos]
@@ -85,7 +85,7 @@ function mathInline(state: StateInline, silent: boolean): boolean {
return true;
}
// check if we have empty content (ex. $$$$) do not parse
// check if we have empty content (ex. $$) do not parse
if (match - start === 0) {
if (!silent) {
state.pending += inlineMathDelimiter + inlineMathDelimiter;