Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use non-greedy *? for display math content #168

Merged
merged 4 commits into from
Sep 28, 2016
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ Groups 1 and 3 match opening and closing dollar signs.
Group 3 matches the mathematical expression contained within.")

(defconst markdown-regex-math-display
"^\\(\\\\\\[\\)\\(\\(?:.\\|\n\\)*\\)?\\(\\\\\\]\\)$"
"^\\(\\\\\\[\\)\\(\\(?:.\\|\n\\)*?\\)?\\(\\\\\\]\\)$"
"Regular expression for itex \[..\] display mode expressions.
Groups 1 and 3 match the opening and closing delimiters.
Group 2 matches the mathematical expression contained within.")
Expand Down Expand Up @@ -6476,9 +6476,9 @@ This is an exact copy of `line-number-at-pos' for use in emacs21."
;; Update font lock keywords with extensions
(setq markdown-mode-font-lock-keywords
(append
(markdown-mode-font-lock-keywords-math)
markdown-mode-font-lock-keywords-basic
(markdown-mode-font-lock-keywords-wiki-links)
(markdown-mode-font-lock-keywords-math)))
(markdown-mode-font-lock-keywords-wiki-links)))
;; Update font lock defaults
(setq font-lock-defaults
'(markdown-mode-font-lock-keywords
Expand Down
9 changes: 8 additions & 1 deletion tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -3745,7 +3745,14 @@ this is not header line
(markdown-test-range-has-face 212 215 markdown-markup-face)
(markdown-test-range-has-face 218 218 markdown-markup-face)
(markdown-test-range-has-face 219 223 markdown-math-face)
(markdown-test-range-has-face 224 224 markdown-markup-face)))
(markdown-test-range-has-face 224 224 markdown-markup-face)
(markdown-test-range-has-face 350 351 markdown-markup-face)
(markdown-test-range-has-face 352 356 markdown-math-face)
(markdown-test-range-has-face 357 358 markdown-markup-face)
(markdown-test-range-has-face 359 391 nil)
(markdown-test-range-has-face 392 393 markdown-markup-face)
(markdown-test-range-has-face 394 398 markdown-math-face)
(markdown-test-range-has-face 399 400 markdown-markup-face)))

(ert-deftest test-markdown-math/font-lock-italics ()
"Test markdown math mode with underscores."
Expand Down
4 changes: 4 additions & 0 deletions tests/math.text
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ $e_{ik}$ in the statement the theorem about $V_k$

$**η = (-1)^{k(n-k)}sη$, where $**η$, is the Hodge star applied twice.

\[ a_1 \]
This is neither math nor italic
\[ a_2 \]

<!-- Local Variables: -->
<!-- markdown-enable-math: t -->
<!-- End: -->