Pandoc:有哪些可用的语法荧光笔? [英] Pandoc: What are the available syntax highlighters?

查看:51
本文介绍了Pandoc:有哪些可用的语法荧光笔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://pandoc.org/demos.html#examples 的第 18 项要点显示如何通过给 --highlight-style 一个参数来改变使用的语法高亮.例如:

Bullet point 18 of http://pandoc.org/demos.html#examples shows how to change the syntax highlighter used by giving an argument to --highlight-style. For example:

pandoc code.text -s --highlight-style pygments -o example18a.html
pandoc code.text -s --highlight-style kate -o example18b.html
pandoc code.text -s --highlight-style monochrome -o example18c.html
pandoc code.text -s --highlight-style espresso -o example18d.html
pandoc code.text -s --highlight-style haddock -o example18e.html
pandoc code.text -s --highlight-style tango -o example18f.html
pandoc code.text -s --highlight-style zenburn -o example18g.html

我想知道是否只有这些配色方案可用.如果没有,我如何加载不同的语法荧光笔?我可以定义自己的吗?

I am wondering if these are the only color schemes available. If not, how can I load a different syntax highlighter? Can I define my own?

推荐答案

Pandoc README 说:

--highlight-style=STYLE|FILE

指定要在突出显示的源代码中使用的着色样式.选项有 pygments(默认)、katemonochromebreezeDarkespressozenburnhaddocktango.有关 pandoc 中语法高亮显示的更多信息,请参阅语法高亮,如下.也可以看看--list-highlight-styles.

Specifies the coloring style to be used in highlighted source code. Options are pygments (the default), kate, monochrome, breezeDark, espresso, zenburn, haddock, and tango. For more information on syntax highlighting in pandoc, see Syntax highlighting, below. See also --list-highlight-styles.

不是 STYLE 名称,而是带有扩展名的 JSON 文件可以提供 .theme.这将被解析为 KDE语法高亮主题和(如果有效)用作突出风格.查看一个示例主题,可以修改,pandoc --print-default-data-file default.theme.

Instead of a STYLE name, a JSON file with extension .theme may be supplied. This will be parsed as a KDE syntax highlighting theme and (if valid) used as the highlighting style. To see a sample theme that can be modified, pandoc --print-default-data-file default.theme.

skylighting(在旧版本中highlighting-kate) 用于突出显示.如果您不喜欢提供的任何配色方案,您可以:

The library skylighting (in older versions highlighting-kate) is used for the highlighting. If you don't like any of the provided color schemes, you can either:

  • 如上所述指定一个 .theme 文件,
  • 导出到 HTML 时,会生成 标签,您可以使用自定义 CSS 设置样式,或者
  • 导出到 LaTeX/PDF 时,您需要使用自定义 Pandoc LaTeX template 并替换带有自定义颜色定义的 $highlighting-macros$ 部分,如 中所述这个问题.
  • Specify a .theme file as mentioned above,
  • when exporting to HTML, <span> tags are generated that you can style with your custom CSS, or
  • when exporting to LaTeX/PDF, you need to use a custom Pandoc LaTeX template and replace the $highlighting-macros$ part with your custom color definitions, as described in this issue.

这篇关于Pandoc:有哪些可用的语法荧光笔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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