File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 975975(require 'url-parse)
976976(require 'button)
977977(require 'color)
978+ (require 'rx)
978979
979980(defvar jit-lock-start)
980981(defvar jit-lock-end)
@@ -4735,7 +4736,9 @@ region. The characters PREFIX will appear at the beginning
47354736of each line."
47364737 (save-excursion
47374738 (let* ((end-marker (make-marker))
4738- (beg-marker (make-marker)))
4739+ (beg-marker (make-marker))
4740+ (prefix-without-trailing-whitespace
4741+ (replace-regexp-in-string (rx (+ blank) eos) "" prefix)))
47394742 ;; Ensure blank line after and remove extra whitespace
47404743 (goto-char end)
47414744 (skip-syntax-backward "-")
@@ -4752,7 +4755,8 @@ of each line."
47524755 (goto-char beg-marker)
47534756 (while (and (< (line-beginning-position) end-marker)
47544757 (not (eobp)))
4755- (insert prefix)
4758+ ;; Don’t insert trailing whitespace.
4759+ (insert (if (eolp) prefix-without-trailing-whitespace prefix))
47564760 (forward-line)))))
47574761
47584762(defun markdown-blockquote-region (beg end)
Original file line number Diff line number Diff line change @@ -922,6 +922,11 @@ Test point position upon removal and insertion."
922922 (should (looking-at "^ > $"))
923923 (should (markdown-next-line-blank-p))))
924924
925+ (ert-deftest test-markdown-insertion/blockquote-region-with-newline ()
926+ (markdown-test-string "a\n\nb\n"
927+ (markdown-blockquote-region 1 (point-max))
928+ (should (equal (buffer-string) "> a\n>\n> b\n\n"))))
929+
925930(ert-deftest test-markdown-insertion/empty-italic ()
926931 "Test `markdown-insert-italic' with no word at point and no region."
927932 (markdown-test-string ""
You can’t perform that action at this time.
0 commit comments