Skip to content

Commit

Permalink
Added support for $$ equations (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Jun 12, 2019
2 parents 3e18124 + c33cf45 commit 6f53f74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/prism-latex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand Down
2 changes: 1 addition & 1 deletion components/prism-latex.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion tests/languages/latex/equation_feature.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
$foo$
$a \dots
b$
$$foo$$
$$a \dots
b$$
\(foo\)
\(a \dots
b\)
Expand Down Expand Up @@ -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 ",
Expand Down Expand Up @@ -118,4 +129,4 @@ b\end{gather}

----------------------------------------------------

Checks for equations.
Checks for equations.

0 comments on commit 6f53f74

Please sign in to comment.