突出显示 Pandoc Revealjs 中的特定代码行 [英] Highlighting specific lines of code in Pandoc Revealjs
问题描述
我正在使用 Pandoc 生成 Reveal.js 演示文稿.它包含围栏代码块中的代码,如下所示:
```java//一些Java代码``
Reveal.js 支持添加高亮的方法到特定的行或行范围,带有应添加到 标记的
data-line-numbers="1"
属性.
我已经尝试通过各种方式将此属性添加到围栏代码块中,例如这样
``` { .java data-line-numbers="1" }//一些Java代码``
但我无法让它工作.有没有办法在 Pandoc 中使用 Reveal.js 的 data-line-numbers
?或者 Pandoc 有办法实现类似的目标?或者我是否需要放弃并在我的 Markdown 中使用那些凌乱的
HTML 标签?
解决方案正确的语法 应该是:
``` {.java .number-lines}//一些Java代码``
Pandoc 自己进行语法高亮,并且对
number-lines
类很敏感.I'm using Pandoc to generate a Reveal.js presentation. It includes code in fenced code blocks, like this:
```java // Some Java code ```
Reveal.js supports a way to add a highlight to a specific line or range of lines, with the
data-line-numbers="1"
attribute that should be added to the<code>
tag.I've tried to add this attribute to the fenced code block in various ways, such as this
``` { .java data-line-numbers="1" } // Some Java code ```
But I can't get it to work. Is there a way to use Reveal.js's
data-line-numbers
in Pandoc? Or perhaps Pandoc has a way to achieve something similar? Or do I need to give up and just use those messy<pre><code>
HTML tags in my Markdown?解决方案The correct syntax should be:
``` {.java .number-lines} // Some Java code ```
Pandoc does the syntax-highlighting itself, and is sensitive to the
number-lines
class.这篇关于突出显示 Pandoc Revealjs 中的特定代码行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!