本文介绍了Pandoc Markdown:忽略PDF中的文本(但包含在HTML中)是否已更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个关于如何包含将以html而不是pdf形式显示的文本的问题已得到两次回答(和),我应用了推荐的解决方案:

This question of how to include text that will appear in html but not pdf has been answered twice (LaTeX multicolumn block in Pandoc markdown and Pandoc markdown: Omit text in PDF version but include in HTML version) and I applied the solution recommended:

以下是来源:

My text.

<div>
This will be ignored in non-HTML output
</div>

Other text

我使用的命令是:pandoc essai.md --from=markdown-markdown_in_html_blocks -o essai.pdf

但是<div>标记之间的文本仍显示在pdf文件中.

Yet the text between the <div>tags is still displayed in the pdf file.

我缺少明显的东西吗?还是自2013/2014年以来pandoc的行为发生了变化(我的版本是2016年的1.19版)?如果是,那么解决方案是什么?

Am I missing something obvious? Or has the behaviour of pandoc changed since 2013/2014 (my version is 1.19 of 2016)? If yes, what would the solution be?

推荐答案

我知道您要求使用与pandoc 1.19兼容的解决方案,但是为了完整起见,这是一个比较干净的解决方案,但仅适用于pandoc 2.0和更高版本:

I know you asked for a solution that works with pandoc 1.19, but for completeness, here is one which is a bit cleaner but only works with pandoc 2.0 and later:

有一个新的 raw_attribute 扩展名,它可以执行以下操作:

There is a new raw_attribute extension, which allows to do the following:

`text in html`{=html}
`text in pdf`{=latex}

默认情况下,它在pandoc markdown中启用.

It is enabled in pandoc markdown per default.

这篇关于Pandoc Markdown:忽略PDF中的文本(但包含在HTML中)是否已更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 09:49