aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-01-07 10:09:06 -0800
committerJohn MacFarlane <[email protected]>2025-01-07 10:09:06 -0800
commit9933a41b76d4600567fd998a0ede174d7ecf2754 (patch)
treea84cd0c3fc2dfe8a84693c40561ae2a250bb7ec7 /src
parent3511f1652e63004a162a7e35e8bdf63b5de9523f (diff)
HTML reader: add size information for fa svg icons.
If the icon has class fa-fw or fa-w16 or fa-w14, we add a width attribute to prevent the icon from appearing full-width in PDF or docx output. Closes #10134.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 29eef2790..7f461bcd8 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -837,7 +837,10 @@ pSvg = do
let rawText = T.strip $ renderTags' (opent : contents ++ [closet])
let svgData = "data:image/svg+xml;base64," <>
UTF8.toText (encode $ UTF8.fromText rawText)
- return $ B.imageWith (ident,cls,[]) svgData mempty mempty
+ let kvs = [("width", "1em") | "fa-w-14" `elem` cls ||
+ "fa-w-16" `elem` cls ||
+ "fa-fw" `elem` cls] -- #10134
+ return $ B.imageWith (ident,cls,kvs) svgData mempty mempty
pCodeWithClass :: PandocMonad m => Text -> Text -> TagParser m Inlines
pCodeWithClass name class' = try $ do