diff options
| author | John MacFarlane <[email protected]> | 2024-10-05 09:31:41 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-10-05 09:31:41 -0700 |
| commit | 70b2c5f3a971822b7f3465a7e3df4848fa2ca04e (patch) | |
| tree | 48f383031de269b08162d1bb2d35dcabc9eaaacf /src | |
| parent | 50007f0273d7383be6ad0ea433fed2b553eadda0 (diff) | |
T.P.SelfContained: improve handling of links to remote CSS.
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 617cdfc33..25b9a9609 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -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 $ |
