haskell - Missing attributes for links and other types of elements in pandoc -


i trying use pandoc (with hakyll, not important) achieve following:

  1. read markdown file.
  2. convert html.
  3. add target="_blank" attribute every link automatically produced.

the problem definition of inline in pandoc seems support attributes types of inlines, 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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -