emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/markdown-mode 01b725e 1/2: Don't apply list face if it is


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 01b725e 1/2: Don't apply list face if it is in code block such as diff snippet
Date: Sun, 1 Aug 2021 02:57:17 -0400 (EDT)

branch: elpa/markdown-mode
commit 01b725ed3d103ee27474636d3faf082ec24dc292
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>

    Don't apply list face if it is in code block such as diff snippet
---
 CHANGES.md             |  2 ++
 markdown-mode.el       |  3 ++-
 tests/markdown-test.el | 11 +++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index e711beb..2f0d95f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -67,6 +67,7 @@
         instead of globally
     -   Modify only the buffer-local part of
         `syntax-propertize-extend-region-functions`.
+    -   Fix list highlighting issue in code block
 
   [gh-290]: https://github.com/jrblevin/markdown-mode/issues/290
   [gh-311]: https://github.com/jrblevin/markdown-mode/issues/311
@@ -95,6 +96,7 @@
   [gh-613]: https://github.com/jrblevin/markdown-mode/issues/613
   [gh-622]: https://github.com/jrblevin/markdown-mode/issues/622
   [gh-625]: https://github.com/jrblevin/markdown-mode/issues/625
+  [gh-631]: https://github.com/jrblevin/markdown-mode/issues/631
 
 # Markdown Mode 2.4
 
diff --git a/markdown-mode.el b/markdown-mode.el
index 70ed9b0..8011637 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -3419,7 +3419,8 @@ SEQ may be an atom or a sequence."
 
 (defun markdown-fontify-list-items (last)
   "Apply font-lock properties to list markers from point to LAST."
-  (when (markdown-match-list-items last)
+  (when (and (markdown-match-list-items last)
+             (not (markdown-code-block-at-point-p (match-beginning 2))))
     (let* ((indent (length (match-string-no-properties 1)))
            (level (/ indent markdown-list-indent-width)) ;; level = 0, 1, 2, 
...
            (bullet (nth (mod level (length markdown-list-item-bullets))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index f45d919..41eb2e5 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -2734,6 +2734,17 @@ See https://github.com/jrblevin/markdown-mode/issues/569";
     (markdown-test-range-has-face 64 64 'markdown-list-face)
     (markdown-test-range-has-face 85 85 'markdown-list-face)))
 
+(ert-deftest test-markdown-font-lock/lists-in-code-block ()
+  "Test markdown-list-face in code block like diff format.
+See https://github.com/jrblevin/markdown-mode/issues/631";
+  (markdown-test-string "```diff
+- plugins=(...)
++ plugins=(... fzf-collection)
+```
+"
+    (should-not (markdown-range-property-any 9 9 'face '(markdown-list-face)))
+    (should-not (markdown-range-property-any 16 16 'face 
'(markdown-list-face)))))
+
 (ert-deftest test-markdown-font-lock/definition-list ()
   "A simple definition list marker font lock test."
   (markdown-test-file "definition-list.text"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]