Commit d4736f08add9456c34b22982643262aef74ac864

RunDevelopment 2019-05-28T14:14:05

Added support for $$ equations

diff --git a/components/prism-latex.js b/components/prism-latex.js
index 6953173..239be55 100644
--- a/components/prism-latex.js
+++ b/components/prism-latex.js
@@ -15,12 +15,12 @@
 			lookbehind: true
 		},
 		/*
-		 * equations can be between $ $ or \( \) or \[ \]
+		 * equations can be between $$ $$ or $ $ or \( \) or \[ \]
 		 * (all are multiline)
 		 */
 		'equation': [
 			{
-				pattern: /\$(?:\\[\s\S]|[^\\$])*\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
+				pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
 				inside: insideEqu,
 				alias: 'string'
 			},
diff --git a/components/prism-latex.min.js b/components/prism-latex.min.js
index fa943e9..9cbc3ff 100644
--- a/components/prism-latex.min.js
+++ b/components/prism-latex.min.js
@@ -1 +1 @@
-!function(a){var e=/\\(?:[^a-z()[\]]|[a-z*]+)/i,n={"equation-command":{pattern:e,alias:"regex"}};Prism.languages.latex={comment:/%.*/m,cdata:{pattern:/(\\begin\{((?:verbatim|lstlisting)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0},equation:[{pattern:/\$(?:\\[\s\S]|[^\\$])*\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,inside:n,alias:"string"},{pattern:/(\\begin\{((?:equation|math|eqnarray|align|multline|gather)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0,inside:n,alias:"string"}],keyword:{pattern:/(\\(?:begin|end|ref|cite|label|usepackage|documentclass)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,lookbehind:!0},url:{pattern:/(\\url\{)[^}]+(?=\})/,lookbehind:!0},headline:{pattern:/(\\(?:part|chapter|section|subsection|frametitle|subsubsection|paragraph|subparagraph|subsubparagraph|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\}(?:\[[^\]]+\])?)/,lookbehind:!0,alias:"class-name"},function:{pattern:e,alias:"selector"},punctuation:/[[\]{}&]/}}();
\ No newline at end of file
+!function(a){var e=/\\(?:[^a-z()[\]]|[a-z*]+)/i,n={"equation-command":{pattern:e,alias:"regex"}};Prism.languages.latex={comment:/%.*/m,cdata:{pattern:/(\\begin\{((?:verbatim|lstlisting)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0},equation:[{pattern:/\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,inside:n,alias:"string"},{pattern:/(\\begin\{((?:equation|math|eqnarray|align|multline|gather)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0,inside:n,alias:"string"}],keyword:{pattern:/(\\(?:begin|end|ref|cite|label|usepackage|documentclass)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,lookbehind:!0},url:{pattern:/(\\url\{)[^}]+(?=\})/,lookbehind:!0},headline:{pattern:/(\\(?:part|chapter|section|subsection|frametitle|subsubsection|paragraph|subparagraph|subsubparagraph|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\}(?:\[[^\]]+\])?)/,lookbehind:!0,alias:"class-name"},function:{pattern:e,alias:"selector"},punctuation:/[[\]{}&]/}}();
\ No newline at end of file
diff --git a/tests/languages/latex/equation_feature.test b/tests/languages/latex/equation_feature.test
index 40caeeb..60191b3 100644
--- a/tests/languages/latex/equation_feature.test
+++ b/tests/languages/latex/equation_feature.test
@@ -1,6 +1,9 @@
 $foo$
 $a \dots
 b$
+$$foo$$
+$$a \dots
+b$$
 \(foo\)
 \(a \dots
 b\)
@@ -36,6 +39,14 @@ b\end{gather}
 		["equation-command", "\\dots"],
 		"\r\nb$"
 	]],
+	["equation", [
+		"$$foo$$"
+	]],
+	["equation", [
+		"$$a ",
+		["equation-command", "\\dots"],
+		"\r\nb$$"
+	]],
 	["equation", ["\\(foo\\)"]],
 	["equation", [
 		"\\(a ",
@@ -118,4 +129,4 @@ b\end{gather}
 
 ----------------------------------------------------
 
-Checks for equations.
\ No newline at end of file
+Checks for equations.