haskell - Missing attributes for links and other types of elements in pandoc -
i trying use pandoc
(with hakyll
, not important) achieve following:
- read markdown file.
- convert html.
- add
target="_blank"
attribute every link automatically produced.
the problem definition of inline
in pandoc
seems support attributes types of inline
s, e.g., span
, code
, , not others, e.g., link
, image
.
is arbitrary limitation of pandoc
, or made on purpose reason not understand? furthermore, there way achieve want, without resorting low-level string processing or using rawinline
constructor?
here mwe:
import text.pandoc import text.pandoc.walk fixlinks :: pandoc -> pandoc fixlinks = walk fixlink fixlink (link inlines (url, title)) = link inlines (url, "i want add target=_blank link!") fixlink inline = inline main = let md = "this link [stackoverflow](http://stackoverflow.com/)." (putstrln . writehtmlstring def . fixlinks . readmarkdown def) md
image , link attributes documented feature 'not in pandoc' on pandoc vs multimarkdown wiki page.
there open issues around this, permit adding attributes markdown elements #684. didn't see attached code/pull requests implement them when looked.
if want add target="_blank"
attribute auto-generated links, think you'll need use workaround in meantime. (and note might not need use raw string processing if post-process html non-pandoc html parser.)
Comments
Post a Comment