Skip to content

Commit

Permalink
Prepend code face, so that it stacks
Browse files Browse the repository at this point in the history
This commit, along with e664c42 close GH-172.
  • Loading branch information
jrblevin committed Jun 13, 2017
1 parent e664c42 commit fc21135
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2596,9 +2596,9 @@ Depending on your font, some reasonable choices are:
(2 markdown-markup-face)
(3 markdown-metadata-value-face)))
(markdown-fontify-hrs)
(markdown-match-code . ((1 markdown-markup-properties)
(2 markdown-inline-code-face)
(3 markdown-markup-properties)))
(markdown-match-code . ((1 markdown-markup-properties prepend)
(2 markdown-inline-code-face prepend)
(3 markdown-markup-properties prepend)))
(,markdown-regex-kbd . ((1 markdown-markup-properties)
(2 markdown-inline-code-face)
(3 markdown-markup-properties)))
Expand Down
19 changes: 13 additions & 6 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2238,12 +2238,16 @@ the opening bracket of [^2], and then subsequent functions would kill [^2])."
"Bold markers in inline code should not trigger bold."
(markdown-test-string
"`def __init__(self):`"
(markdown-test-range-has-face 8 11 markdown-inline-code-face))
(markdown-test-range-has-face 8 11 'markdown-inline-code-face)
(should-not (markdown-range-property-any
(point-min) (point-max) 'face '(markdown-bold-face))))
(markdown-test-string
"`**foo` bar `baz**`"
(markdown-test-range-face-equals 2 6 markdown-inline-code-face)
(markdown-test-range-has-face 2 6 'markdown-inline-code-face)
(markdown-test-range-face-equals 9 11 nil)
(markdown-test-range-face-equals 14 18 markdown-inline-code-face)))
(markdown-test-range-has-face 14 18 'markdown-inline-code-face)
(should-not (markdown-range-property-any
(point-min) (point-max) 'face '(markdown-bold-face)))))

(ert-deftest test-markdown-font-lock/code-1 ()
"A simple inline code test."
Expand Down Expand Up @@ -2871,17 +2875,20 @@ takes precedence)."
(ert-deftest test-markdown-font-lock/snake-case-code-in-heading ()
"Test underscores in inline code in headings."
(markdown-test-string "# Title with `snake_case_code`"
(should-not (markdown-range-property-any 21 24 'face '(markdown-italic-face)))))
(should-not (markdown-range-property-any 21 24 'face '(markdown-italic-face)))
(markdown-test-range-has-face 15 29 'markdown-inline-code-face)))

(ert-deftest test-markdown-font-lock/stars-in-code-in-heading ()
"Test asterisks in inline code in headings."
(markdown-test-string "# Title with `char** foo, int* bar`"
(should-not (markdown-range-property-any 20 29 'face '(markdown-italic-face)))))
(should-not (markdown-range-property-any 20 29 'face '(markdown-italic-face)))
(markdown-test-range-has-face 15 34 'markdown-inline-code-face)))

(ert-deftest test-markdown-font-lock/stars-in-code-in-blockquote ()
"Test asterisks in inline code in blockquote."
(markdown-test-string "> Quote with `**stars**`"
(should-not (markdown-range-property-any 17 21 'face '(markdown-italic-face)))))
(should-not (markdown-range-property-any 17 21 'face '(markdown-italic-face)))
(markdown-test-range-has-face 15 23 'markdown-inline-code-face)))

(ert-deftest test-markdown-font-lock/two-bold-words-after-list ()
"Test two bold words after a list marker."
Expand Down

0 comments on commit fc21135

Please sign in to comment.