Skip to content

Commit

Permalink
Fix font-lock for inline code inside bold
Browse files Browse the repository at this point in the history
Related to GH-275.
  • Loading branch information
jrblevin committed Nov 10, 2017
1 parent 1c2e8e1 commit a01883f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
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][])
- Fix font-lock for inline code inside italics and bold.
([GH-275][])

[gh-171]: https://github.com/jrblevin/markdown-mode/issues/171
[gh-216]: https://github.com/jrblevin/markdown-mode/issues/216
Expand Down
3 changes: 1 addition & 2 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3722,8 +3722,7 @@ When FACELESS is non-nil, do not return matches where faces have been applied."
begin begin 'face '(markdown-url-face
markdown-plain-url-face))
(markdown-range-property-any
begin end 'face '(markdown-inline-code-face
markdown-math-face)))
begin end 'face '(markdown-math-face)))
(progn (goto-char (min (1+ begin) last))
(when (< (point) last)
(markdown-match-italic last)))
Expand Down
11 changes: 11 additions & 0 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2275,6 +2275,17 @@ See GH-275."
(should-not (markdown-range-property-any
(point-min) (point-max) 'face '(markdown-bold-face)))))

(ert-deftest test-markdown-font-lock/code-in-bold ()
"Test inline code inside bold."
(markdown-test-string
"**text `code` text**"
(markdown-test-range-has-face 1 2 markdown-markup-face)
(markdown-test-range-has-face 3 18 markdown-bold-face)
(markdown-test-range-has-face 8 8 markdown-markup-face)
(markdown-test-range-has-face 9 12 markdown-inline-code-face)
(markdown-test-range-has-face 13 13 markdown-markup-face)
(markdown-test-range-has-face 19 20 markdown-markup-face)))

(ert-deftest test-markdown-font-lock/bold-in-comment ()
"Test not matching bold in comments."
(markdown-test-string
Expand Down

0 comments on commit a01883f

Please sign in to comment.