Pandoc inline .class and .id elements

不打扰是莪最后的温柔 提交于 2019-12-23 22:07:13

问题


My Question: Is there a way in Pandoc markdown to mark inline class (or id) elements that could then be output to LaTeX and html and if so, how?

I am looking for a "one input many outputs" publication solution with needed output of LaTeX and epub, but with desired output of .docx. In LaTeX I have defined \mytag{foo} which would correspond to <span class="myclass">foo</span> in html for certain word level mark up. (In MSWord, Libreoffice and Adobe Indesign it is possible to set character styles for this purpose.)

The closest thing I can find to an answer is this minimalistic statement and example from the Pandoc documenation:

Headers can be assigned attributes using this syntax at the end of the line containing the header text:

{#identifier .class .class key=value key=value}


回答1:


pandoc got updated recently, now you can do:

`code with class`{.class}

and

[Span with class]{.class}



回答2:


No, there's no way to mark arbitrary elements (though the syntax you mention works for headers).

You can use HTML spans and divs with attributes. These can contain Markdown content, and will produce native pandoc Span and Div elements in the internal document model (AST). These can be intercepted by filters and replaced with raw LaTeX when you're targeting LaTeX -- you have to do a bit of scripting for this, but it's fairly minimal. If you have trouble writing a filter, people on pandoc-discuss are often glad to help.



来源:https://stackoverflow.com/questions/33748781/pandoc-inline-class-and-id-elements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!