Markdown writer: use raw HTML for link/image attributes when
the `link_attributes` extension is unset and `raw_html` is set. Closes #2554.
This commit is contained in:
parent
2df4f39db3
commit
6d91fb2563
1 changed files with 12 additions and 2 deletions
|
@ -906,7 +906,12 @@ inlineToMarkdown opts (Cite (c:cs) lst)
|
|||
return $ pdoc <+> r
|
||||
modekey SuppressAuthor = "-"
|
||||
modekey _ = ""
|
||||
inlineToMarkdown opts (Link attr txt (src, tit)) = do
|
||||
inlineToMarkdown opts lnk@(Link attr txt (src, tit))
|
||||
| isEnabled Ext_raw_html opts &&
|
||||
not (isEnabled Ext_link_attributes opts) &&
|
||||
attr /= nullAttr = -- use raw HTML
|
||||
return $ text $ trim $ writeHtmlString def $ Pandoc nullMeta [Plain [lnk]]
|
||||
| otherwise = do
|
||||
plain <- gets stPlain
|
||||
linktext <- inlineListToMarkdown opts txt
|
||||
let linktitle = if null tit
|
||||
|
@ -940,7 +945,12 @@ inlineToMarkdown opts (Link attr txt (src, tit)) = do
|
|||
else "[" <> linktext <> "](" <>
|
||||
text src <> linktitle <> ")" <>
|
||||
linkAttributes opts attr
|
||||
inlineToMarkdown opts (Image attr alternate (source, tit)) = do
|
||||
inlineToMarkdown opts img@(Image attr alternate (source, tit))
|
||||
| isEnabled Ext_raw_html opts &&
|
||||
not (isEnabled Ext_link_attributes opts) &&
|
||||
attr /= nullAttr = -- use raw HTML
|
||||
return $ text $ trim $ writeHtmlString def $ Pandoc nullMeta [Plain [img]]
|
||||
| otherwise = do
|
||||
plain <- gets stPlain
|
||||
let txt = if null alternate || alternate == [Str source]
|
||||
-- to prevent autolinks
|
||||
|
|
Loading…
Add table
Reference in a new issue