diff --git a/markdown-mode.el b/markdown-mode.el index c012f9d8..8dd28cd7 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -7692,12 +7692,14 @@ Return the name of the output buffer used." Insert the output in the buffer named OUTPUT-BUFFER-NAME." (interactive) (setq output-buffer-name (markdown output-buffer-name)) - (with-current-buffer output-buffer-name - (set-buffer output-buffer-name) - (unless (markdown-output-standalone-p) - (markdown-add-xhtml-header-and-footer output-buffer-name)) - (goto-char (point-min)) - (html-mode)) + (let ((css-path markdown-css-paths)) + (with-current-buffer output-buffer-name + (set-buffer output-buffer-name) + (setq-local markdown-css-paths css-path) + (unless (markdown-output-standalone-p) + (markdown-add-xhtml-header-and-footer output-buffer-name)) + (goto-char (point-min)) + (html-mode))) output-buffer-name) (defun markdown-other-window (&optional output-buffer-name) diff --git a/tests/markdown-test.el b/tests/markdown-test.el index 21c7a033..abb90482 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -6158,6 +6158,20 @@ bar baz" (kill-buffer obuffer) (delete-file ofile)))) +(ert-deftest test-markdown-export/buffer-local-css-path () + "Test buffer local `markdown-css-paths'" + (let ((markdown-css-paths '("./global.css"))) + (markdown-test-temp-file "inline.text" + (setq-local markdown-css-paths '("./local.css")) + (let* ((markdown-export-kill-buffer nil) + (file (markdown-export)) + (buffer (get-file-buffer file))) + (with-current-buffer buffer + (goto-char (point-min)) + (should (search-forward "href=\"./local.css\""))) + (kill-buffer buffer) + (delete-file file))))) + ;;; Hook tests: (ert-deftest test-markdown-hook/before-export ()