diff --git a/markdown-mode.el b/markdown-mode.el index a6d75353..93d88b6b 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -1195,7 +1195,7 @@ Group 5 matches the reference label.") "Regexp identifying Markdown headers.") (defconst markdown-regex-header-1-atx - "^\\(#\\)[ \t]*\\(.+?\\)[ \t]*\\(#*\\)$" + "^\\(#\\)[ \t]*\\([^\\.].*?\\)[ \t]*\\(#*\\)$" "Regular expression for level 1 atx-style (hash mark) headers.") (defconst markdown-regex-header-2-atx @@ -1259,7 +1259,7 @@ Group 2 matches the key sequence.") "Regular expression for matching preformatted text sections.") (defconst markdown-regex-list - "^\\([ \t]*\\)\\([0-9]+\\.\\|[\\*\\+-]\\)\\([ \t]+\\)" + "^\\([ \t]*\\)\\([0-9#]+\\.\\|[\\*\\+-]\\)\\([ \t]+\\)" "Regular expression for matching list items.") (defconst markdown-regex-bold @@ -4681,7 +4681,7 @@ This is an exact copy of `line-number-at-pos' for use in emacs21." "Return prefix for filling paragraph or nil if not determined." (cond ;; List item inside blockquote - ((looking-at "^[ \t]*>[ \t]*\\([0-9]+\\.\\|[*+-]\\)[ \t]+") + ((looking-at "^[ \t]*>[ \t]*\\(\\(?:[0-9]+\\|#\\)\\.\\|[*+-]\\)[ \t]+") (replace-regexp-in-string "[0-9\\.*+-]" " " (match-string-no-properties 0))) ;; Blockquote @@ -4789,7 +4789,7 @@ if ARG is omitted or nil." "\f" ; starts with a literal line-feed "[ \t\f]*$" ; space-only line "[ \t]*[*+-][ \t]+" ; unordered list item - "[ \t]*[0-9]+\\.[ \t]+" ; ordered list item + "[ \t]*\\(?:[0-9]+\\|#\\)\\.[ \t]+" ; ordered list item "[ \t]*\\[\\S-*\\]:[ \t]+" ; link ref def ) "\\|")) diff --git a/tests/markdown-test.el b/tests/markdown-test.el index bbc45466..fd454dd8 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -2593,6 +2593,22 @@ See `paragraph-separate'." (markdown-test-range-has-face 24 26 markdown-pre-face) (markdown-test-range-has-face 28 30 markdown-pre-face))) +;;; Tests for other extensions: + +(ert-deftest test-markdown-ext/pandoc-fancy-lists () + "Test basic support for font lock and filling of Pandoc 'fancy lists'." + (markdown-test-string " #. abc\ndef\n" + ;; font lock + (markdown-test-range-has-face 1 1 nil) + (markdown-test-range-has-face 2 3 markdown-list-face) + (markdown-test-range-has-face 4 11 nil) + ;; filling + (forward-line) + (markdown-indent-region (line-beginning-position) (line-end-position) nil) + (should (string-equal (buffer-string) " #. abc\n def\n")) + (markdown-indent-region (line-beginning-position) (line-end-position) nil) + (should (string-equal (buffer-string) " #. abc\n def\n")))) + (provide 'markdown-test) ;;; markdown-test.el ends here