branch: elpa/markdown-mode commit 1169bf18feea76cc644131c6a39227b825f71d52 Author: Shohei YOSHIDA <syo...@gmail.com> Commit: Shohei YOSHIDA <syo...@gmail.com>
Improve setext regexp for fill-paragraph --- markdown-mode.el | 2 +- tests/markdown-test.el | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index 35c2f07..5db1068 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -9730,7 +9730,7 @@ rows and columns and the column alignment." ;; not paragraph-ending suffixes: ".* $" ; line ending in two spaces "^#+" - "^[-=]+" + "^\\(?: \\)?[-=]+[ \t]*$" ;; setext "[ \t]*\\[\\^\\S-*\\]:[ \t]*$") ; just the start of a footnote def "\\|")) (setq-local adaptive-fill-first-line-regexp "\\`[ \t]*[A-Z]?>[ \t]*?\\'") diff --git a/tests/markdown-test.el b/tests/markdown-test.el index 669c94a..cbc1bbc 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -5586,7 +5586,24 @@ Details: https://github.com/jrblevin/markdown-mode/issues/638" ")) (markdown-test-string input (markdown-fill-paragraph) - (should (string= (buffer-string) input))))) + (should (string= (buffer-string) input)))) + (let ((input "Heading +- +")) + (markdown-test-string input + (markdown-fill-paragraph) + (should (string= (buffer-string) input)))) + ;; leading 3 spaces and trailing spaces is ok + (let ((input "Heading + ==== \t\n")) + (markdown-test-string input + (markdown-fill-paragraph) + (should (string= (buffer-string) input)))) + ;; fill-paragraph is applied for list element + (markdown-test-string "- foo +bar baz" + (markdown-fill-paragraph) + (should (string= (buffer-string) "- foo bar baz")))) ;;; Export tests: