用相同的来源制作降价幻灯片和文章 [英] Producing markdown slides and article with the same source

查看:79
本文介绍了用相同的来源制作降价幻灯片和文章的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 markdown/knitr/pandoc 来制作文档和幻灯片,作为 LaTeX/Beamer 的替代品.

I'm trying markdown/knitr/pandoc for producing documentation and slides as an alternative to LaTeX/Beamer.

我想念的一个功能是可以对两种类型的输出(幻灯片和文章)使用相同的来源,同时能够标记特定于任何一种格式的内容.未标记的内容将同时显示在演示文稿文章模式中.

One funcionality I miss is the possibility to use the same source for both types of output (slides and articles), while being able to mark content which is specific to either format. Unmarked content will appear in both presentation and article modes.

我了解可以通过在YAML标头中指定多个* output *来使用Pandoc-markdown生成具有相同源的两种类型的输出.

I understand I can produce both types of output with the same source with Pandoc-markdown by specifying several *output*s in the YAML header.

但是,我不知道如何防止段落出现在幻灯片中或项目符号列表出现在文章中.

However, I can't figure out how to prevent paragraphs to appear in the slides, or bullet lists to appear in the article.

这可能吗?

推荐答案

Pandoc本身不支持此功能,但是 GPP ,然后编写如下内容:

This is not natively supported by Pandoc, however you can use a preprocessor. Basically he uses GPP and then writes stuff like:

<#ifdef SLIDES>
     slide text
<#endif>
<#ifdef ARTICLE> 
     article text 
<#endif>

如果您了解一些Python或只有一点点Haskell,则可以避免安装GPP并编写一个简单的脚本来更改Markdown AST,请参见

If you know some Python or only a bit of Haskell, you can avoid installing GPP and write a simple script instead that changes the Markdown AST, see Pandoc scripting. Then you'd probably do something like:

<div class="slides">
  slide text
</div>
<div class="article">
  article text
</div>

这篇关于用相同的来源制作降价幻灯片和文章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆