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

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

[nongnu] elpa/markdown-mode 4a4ed7e08a 1/2: fill-paragraph considers GFM


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 4a4ed7e08a 1/2: fill-paragraph considers GFM alert syntax
Date: Thu, 7 Nov 2024 01:00:19 -0500 (EST)

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

    fill-paragraph considers GFM alert syntax
---
 CHANGES.md             |  2 ++
 markdown-mode.el       |  5 +++++
 tests/markdown-test.el | 10 ++++++++++
 3 files changed, 17 insertions(+)

diff --git a/CHANGES.md b/CHANGES.md
index fdb343f23c..d7a1d1ff99 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -13,6 +13,7 @@
       variable `markdown-special-ctrl-a/e`, like Org mode.
     - Trailing whitespace characters for line breaks are hidden when using
       `markdown-hide-markup`
+    - `fill-paragraph` considers GFM alert syntax [GH-838][]
 
 *   Bug fixes:
     - Don't highlight superscript/subscript in math inline/block [GH-802][]
@@ -35,6 +36,7 @@
   [gh-817]: https://github.com/jrblevin/markdown-mode/issues/817
   [gh-827]: https://github.com/jrblevin/markdown-mode/issues/827
   [gh-834]: https://github.com/jrblevin/markdown-mode/issues/834
+  [gh-838]: https://github.com/jrblevin/markdown-mode/issues/838
   [gh-845]: https://github.com/jrblevin/markdown-mode/issues/845
   [gh-848]: https://github.com/jrblevin/markdown-mode/issues/848
 
diff --git a/markdown-mode.el b/markdown-mode.el
index c63f540506..89d896296b 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -10305,6 +10305,11 @@ rows and columns and the column alignment."
   (setq markdown-link-space-sub-char "-")
   (setq markdown-wiki-link-search-subdirectories t)
   (setq-local markdown-table-at-point-p-function #'gfm--table-at-point-p)
+  (setq-local paragraph-separate
+              (concat paragraph-separate
+                      "\\|"
+                      ;; GFM alert syntax
+                      
"^>\s-*\\[!\\(?:NOTE\\|TIP\\|IMPORTANT\\|WARNING\\|CAUTION\\)\\]"))
   (add-hook 'post-self-insert-hook #'gfm--electric-pair-fence-code-block 
'append t)
   (markdown-gfm-parse-buffer-for-languages))
 
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index ee61abd364..f6be7d30aa 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -6107,6 +6107,16 @@ bar baz"
     (markdown-fill-paragraph)
     (should (string= (buffer-string) "- foo bar baz"))))
 
+(ert-deftest test-markdown-filling/gfm-alert ()
+  "Fill paragraph at GFM alert."
+  (let ((levels '("NOTE" "TIP" "IMPORTANT" "WARNING" "CAUTION"))
+        (template "> [!%s]\foo bar baz"))
+    (dolist (level levels)
+      (let ((input (format template level)))
+        (markdown-test-string-mode 'gfm-mode input
+          (markdown-fill-paragraph)
+          (should (string= (buffer-string) input)))))))
+
 ;;; Export tests:
 
 (ert-deftest test-markdown-hook/xhtml-standalone ()



reply via email to

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