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

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

[nongnu] elpa/markdown-mode e100778594 2/2: Merge pull request #870 from


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode e100778594 2/2: Merge pull request #870 from mattiasb/fix/869-http-css
Date: Thu, 9 Jan 2025 01:00:15 -0500 (EST)

branch: elpa/markdown-mode
commit e1007785947ac8b32d8977a2843a11aded40682b
Merge: 8692afc12e 5ee6a11294
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #870 from mattiasb/fix/869-http-css
    
    Make it possible to use style sheet URLs again
---
 CHANGES.md             |  3 ++-
 markdown-mode.el       |  4 +++-
 tests/markdown-test.el | 15 ++++++++++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 50709e47bd..55e63f647d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -30,7 +30,7 @@
     - Change temporary buffer name according to the Emacs naming convention 
[GH-848][]
     - Mark `markdown-css-paths` safe as file local variables [GH-834][]
     - Resolve style sheets in `markdown-css-paths` relative to the Markdown 
file
-      [GH-855][]
+      (if the path starts with `./` or `../`) [GH-855][] [GH-870][]
 
   [gh-780]: https://github.com/jrblevin/markdown-mode/issues/780
   [gh-802]: https://github.com/jrblevin/markdown-mode/issues/802
@@ -43,6 +43,7 @@
   [gh-845]: https://github.com/jrblevin/markdown-mode/issues/845
   [gh-848]: https://github.com/jrblevin/markdown-mode/issues/848
   [gh-855]: https://github.com/jrblevin/markdown-mode/issues/855
+  [gh-870]: https://github.com/jrblevin/markdown-mode/issues/870
 
 # Markdown Mode 2.6
 
diff --git a/markdown-mode.el b/markdown-mode.el
index 99c61cb718..a262623162 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -7736,7 +7736,9 @@ Standalone XHTML output is identified by an occurrence of
 
 (defun markdown-stylesheet-link-string (stylesheet-path)
   (concat "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\""
-          (expand-file-name stylesheet-path)
+          (or (and (string-match-p (rx (or "~" "./" "../")) stylesheet-path)
+                   (expand-file-name stylesheet-path))
+              stylesheet-path)
           "\"  />"))
 
 (defun markdown-escape-title (title)
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 9505e4a52c..c62392e1fc 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -6182,6 +6182,19 @@ bar baz"
       (kill-buffer obuffer)
       (delete-file ofile))))
 
+(ert-deftest test-markdown-export/url-css-path ()
+  "Test `markdown-css-paths' as URL."
+  (let ((markdown-css-paths '("http://www.example.com/style.css";)))
+    (markdown-test-temp-file "inline.text"
+      (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=\"http://www.example.com/style.css\"";)))
+        (kill-buffer buffer)
+        (delete-file file)))))
+
 (ert-deftest test-markdown-export/buffer-local-css-path ()
   "Test buffer local `markdown-css-paths'"
   (let ((markdown-css-paths '("/global.css")))
@@ -6198,7 +6211,7 @@ bar baz"
 
 (ert-deftest test-markdown-export/relative-css-path ()
   "Test relative `markdown-css-paths'."
-  (let ((markdown-css-paths '("style.css")))
+  (let ((markdown-css-paths '("./style.css")))
     (markdown-test-temp-file "inline.text"
       (let* ((markdown-export-kill-buffer nil)
              (file (markdown-export))



reply via email to

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