Skip to content

Commit

Permalink
Fix font-lock for inline code inside italics
Browse files Browse the repository at this point in the history
Closes GH-275.
  • Loading branch information
jrblevin committed Nov 10, 2017
1 parent fb2cacd commit 4e733e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
load time. ([GH-273][])
- Don't clobber user specified font-lock keywords when toggling
features. ([GH-222][])
- Fix font-lock for inline code inside italics. ([GH-275][])

[gh-171]: https://github.com/jrblevin/markdown-mode/issues/171
[gh-216]: https://github.com/jrblevin/markdown-mode/issues/216
Expand Down Expand Up @@ -84,6 +85,7 @@
[gh-272]: https://github.com/jrblevin/markdown-mode/issues/272
[gh-273]: https://github.com/jrblevin/markdown-mode/issues/273
[gh-274]: https://github.com/jrblevin/markdown-mode/pull/274
[gh-275]: https://github.com/jrblevin/markdown-mode/issues/275
[gh-276]: https://github.com/jrblevin/markdown-mode/issues/276
[gh-277]: https://github.com/jrblevin/markdown-mode/pull/277

Expand Down
5 changes: 3 additions & 2 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3743,9 +3743,10 @@ When FACELESS is non-nil, do not return matches where faces have been applied."
(markdown-range-property-any
begin begin 'face '(markdown-url-face
markdown-plain-url-face))
(markdown-inline-code-at-pos-p begin)
(markdown-inline-code-at-pos-p end)
(markdown-range-property-any
begin end 'face '(markdown-inline-code-face
markdown-bold-face
begin end 'face '(markdown-bold-face
markdown-list-face
markdown-math-face)))
(progn (goto-char (min (1+ begin) last))
Expand Down
12 changes: 12 additions & 0 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2149,6 +2149,18 @@ Should not cause an infinite loop."
(markdown-test-range-has-face 1 10 nil)
(markdown-test-range-has-face 12 16 markdown-inline-code-face)))

(ert-deftest test-markdown-font-lock/code-in-italics ()
"Test inline code inside italics.
See GH-275."
(markdown-test-string
"*text `code` text*"
(markdown-test-range-has-face 1 1 markdown-markup-face)
(markdown-test-range-has-face 2 17 markdown-italic-face)
(markdown-test-range-has-face 7 7 markdown-markup-face)
(markdown-test-range-has-face 8 11 markdown-inline-code-face)
(markdown-test-range-has-face 12 12 markdown-markup-face)
(markdown-test-range-has-face 18 18 markdown-markup-face)))

(ert-deftest test-markdown-font-lock/italics-in-reference-definitions ()
"Test not matching italics in reference definitions across lines."
(markdown-test-string
Expand Down

0 comments on commit 4e733e3

Please sign in to comment.