Skip to content

Commit

Permalink
T.P.SelfContained: improve handling of links to remote CSS.
Browse files Browse the repository at this point in the history
Previously these were only converted to a `<style>` element
if the link was being served with a text/css mime type (not
e.g. text/plain).  We now add a secondary check for `rel="stylesheet"`
to better handle such cases.

Closes #10261.
  • Loading branch information
jgm committed Oct 5, 2024
1 parent 50007f0 commit 70b2c5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Text/Pandoc/SelfContained.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ convertTags (t@(TagOpen "link" as):ts) =
(("href",dataUri) : [(x,y) | (x,y) <- as, x /= "href"]) :
rest
Fetched (mime, bs)
| "text/css" `T.isPrefixOf` mime
| ("text/css" `T.isPrefixOf` mime ||
fromAttrib "rel" t == "stylesheet")
&& T.null (fromAttrib "media" t)
&& not ("</" `B.isInfixOf` bs) -> do
rest <- convertTags $
Expand Down

0 comments on commit 70b2c5f

Please sign in to comment.