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

Fix issue67 #68

Merged
merged 2 commits into from
Jan 10, 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
12 changes: 11 additions & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,15 @@ Return nil otherwise."
(match-beginning 5) (match-end 5)))
(goto-char (1+ (match-end 0)))))

(defun markdown-list-p (pos)
(save-excursion
(goto-char pos)
(goto-char (line-beginning-position))
(looking-at-p markdown-regex-list)))

(defun markdown-same-line-p (pos1 pos2)
(= (markdown-line-number-at-pos pos1) (markdown-line-number-at-pos pos2)))

(defun markdown-match-italic (last)
"Match inline italics from the point to LAST."
(let ((regex (if (eq major-mode 'gfm-mode)
Expand All @@ -2446,7 +2455,8 @@ Return nil otherwise."
markdown-math-face))
(goto-char (1+ (match-end 0)))
(markdown-match-italic last))
(t
((or (markdown-same-line-p begin end)
(not (or (markdown-list-p begin) (markdown-list-p end))))
(set-match-data (list (match-beginning 1) (match-end 1)
(match-beginning 2) (match-end 2)
(match-beginning 3) (match-end 3)
Expand Down
14 changes: 12 additions & 2 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1743,12 +1743,22 @@ the opening bracket of [^2], and then subsequent functions would kill [^2])."

(ert-deftest test-markdown-font-lock/italics-6 ()
"Test multiline italics across list items."
:expected-result :failed
(markdown-test-string
"* something about function foo_bar
* something else about foo_bar"
(markdown-test-range-has-face 31 34 nil)
(markdown-test-range-has-face 38 62 nil)))
(markdown-test-range-has-face 38 62 nil))
(markdown-test-string
"foo_bar
* foo_bar"
(markdown-test-range-has-face 4 7 nil)
(markdown-test-range-has-face 11 14 nil))

(markdown-test-string
"* foo_bar
foo_bar"
(markdown-test-range-has-face 6 9 nil)
(markdown-test-range-has-face 11 14 nil)))

(ert-deftest test-markdown-font-lock/italics-after-hr ()
"Test italics after a horizontal rule with asterisks."
Expand Down