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

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

[nongnu] elpa/markdown-mode 8a7773f877 2/2: Merge pull request #836 from


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 8a7773f877 2/2: Merge pull request #836 from jimporter/escaped-fontified-code-blocks
Date: Tue, 16 Jul 2024 01:00:06 -0400 (EDT)

branch: elpa/markdown-mode
commit 8a7773f87733866a961ea4c518a4a2f283f21970
Merge: 8aab017f47 55959ac881
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #836 from jimporter/escaped-fontified-code-blocks
    
    Never hide backslash escapes in fontified code blocks
---
 CHANGES.md              |  2 ++
 markdown-mode.el        |  3 ++-
 tests/markdown-test.el  | 26 +++++++++++++++++++++-----
 tests/outline-code.text |  2 ++
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3236ad8d3b..8deb688733 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -18,6 +18,8 @@
     - Don't highlight superscript/subscript in math inline/block [GH-802][]
     - Fix table alignment when a column has a seperator in code block 
[GH-817][]
     - Fix the regexp in the download languages script [GH-827][]
+    - Don't hide backslashes in code blocks when using `markdown-hide-markup`
+      and `markdown-fontify-code-blocks-natively` together [GH-766][]
 
 *   Improvements:
     - Apply url-unescape against URL in an inline link [GH-805][]
diff --git a/markdown-mode.el b/markdown-mode.el
index cba34f1d0e..7c41f768d8 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -1141,7 +1141,8 @@ Group 4 matches the text inside the delimiters.")
   "Property list of all Markdown syntactic properties.")
 
 (defvar markdown-literal-faces
-  '(markdown-inline-code-face
+  '(markdown-code-face
+    markdown-inline-code-face
     markdown-pre-face
     markdown-math-face
     markdown-url-face
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index abb90482af..b1a881dcaa 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -2243,9 +2243,25 @@ See GH-245."
       (markdown-test-range-has-property 83 93 'invisible 'markdown-markup)
       (should (invisible-p 83))
       (should (invisible-p 93))
-      (markdown-test-range-has-property 154 156 'invisible 'markdown-markup)
-      (should (invisible-p 154))
-      (should (invisible-p 156)))))
+      ;; The backslash in the Bash script should be visible.
+      (should-not (invisible-p 167))
+      (markdown-test-range-has-property 174 176 'invisible 'markdown-markup)
+      (should (invisible-p 174))
+      (should (invisible-p 176)))))
+
+(ert-deftest test-markdown-markup-hiding/fenced-code-blocks-fontified ()
+  "Test hiding markup for tilde fenced code blocks with fontification."
+  (let ((markdown-hide-markup t)
+        (markdown-fontify-code-blocks-natively t))
+    (markdown-test-file "outline-code.text"
+      (markdown-test-range-has-property 83 93 'invisible 'markdown-markup)
+      (should (invisible-p 83))
+      (should (invisible-p 93))
+      ;; The backslash in the Bash script should be visible.
+      (should-not (invisible-p 167))
+      (markdown-test-range-has-property 174 176 'invisible 'markdown-markup)
+      (should (invisible-p 174))
+      (should (invisible-p 176)))))
 
 (ert-deftest test-markdown-markup-hiding/escape ()
   "Test hiding markup for backslash escapes."
@@ -4838,7 +4854,7 @@ Detail: 
https://github.com/jrblevin/markdown-mode/issues/392";
   (markdown-test-file "outline-code.text"
     ;; Navigate forward at the same level
     (markdown-forward-same-level 1)
-    (should (eq (point) 159))
+    (should (eq (point) 179))
     (should (looking-at "^# Level one again"))))
 
 (ert-deftest test-markdown-outline/back-to-heading-over-code-block ()
@@ -4927,7 +4943,7 @@ Detail: 
https://github.com/jrblevin/markdown-mode/issues/392";
       (should (eq (point) 69))
       (should (looking-at "^## Level two"))
       (outline-next-visible-heading 1)
-      (should (eq (point) 159))
+      (should (eq (point) 179))
       (should (looking-at "^# Level one again")))))
 
 (ert-deftest test-markdown-outline/visibility-with-metadata ()
diff --git a/tests/outline-code.text b/tests/outline-code.text
index 188f4627f2..4b075d1a91 100644
--- a/tests/outline-code.text
+++ b/tests/outline-code.text
@@ -10,6 +10,8 @@
 #!/bin/bash
 
 # In a code block, this shouldn't be a header
+
+echo -e "foo\nbar"
 ~~~
 
 # Level one again



reply via email to

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