Skip to content

Commit

Permalink
Remove DOCTYPE tag from inlined SVG's as well
Browse files Browse the repository at this point in the history
Fixes #470
  • Loading branch information
kaushalmodi committed Nov 26, 2021
1 parent 5f73f0f commit 8bdfa0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ox-hugo.el
Expand Up @@ -2190,7 +2190,10 @@ and rewrite link paths to make blogging more seamless."
;; Remove the xml document tag as that cannot be inlined in-between
;; a Markdown (or even an HTML) file.
"<\\?xml version=\"1\\.0\" encoding=\"UTF-8\" standalone=\"no\"\\?>" ""
svg-contents)))
;; Remove !DOCTYPE tag from the inlined SVG.
(replace-regexp-in-string
"<!DOCTYPE svg[^>]+>" ""
svg-contents))))
(caption-html (if (not caption)
""
(format (concat "\n\n<div class=\"figure-caption\">\n"
Expand Down
2 changes: 1 addition & 1 deletion test/site/content-org/images/svg-from-issue-470.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/site/content/issues/470/index.md
Expand Up @@ -18,8 +18,8 @@ With the `DOCTYPE` tag removed, the browser doesn't throw any error
(below is the SVG from that issue.. seems like it's just blank. But
you will be able to see when you view this page's source).

<svg
width="100%" height="100%" viewBox="0 0 1485 440" version="1.1"
<svg width="100%"
height="100%" viewBox="0 0 1485 440" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
xmlns:serif="http://www.serif.com/"
Expand Down

0 comments on commit 8bdfa0e

Please sign in to comment.