在哪里可以找到“所有 Rouge 选项”?

发布于 2025-01-16 03:59:43 字数 546 浏览 4 评论 0原文

我正在使用 Jekyll 创建一个静态网站。 我想使用 _config.yml 在 kramdown 中配置 rouge。

浏览完 jekyllkramdown,我发现它提到

此外,所有 Rouge 选项(例如“line_numbers”)都可以直接在“syntax_highlighter_opts”选项(它们应用于代码跨度和代码块)和/或“span”/“block”键上设置。

但我找不到“所有 Rouge 选项” 在哪里。 在哪里可以找到“所有 Rouge 选项”

I am using Jekyll to create a static website.
I want to use _config.yml to configure rouge in kramdown.

After looking through the documentation for jekyll and kramdown, I found that it mentions

Furthermore all Rouge options (e.g. ‘line_numbers’) can be set directly on the ‘syntax_highlighter_opts’ option (where they apply to code spans and code blocks) and/or on the ‘span’/’block’ keys.

But I can't find where the "all Rouge options" are.
Where can I find "all Rouge options"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小霸王臭丫头 2025-01-23 03:59:43

也许就是您正在寻找的?

Rouge语法高亮支持以下选项键
'syntax_highlighter_opts':

default_lang 无语言时应使用的默认语言
已设置。 guess_lang 如果没有特定语言或默认语言
设置,猜测语言。 formatter 自定义 Rouge 格式化程序类
应该使用而不是以下默认格式化程序(Rogue 1.x:
Rouge::Formatters::HTML / Rogue 2.x: Rouge::Formatters::HTMLLegacy)。
如果此设置是一个字符串,则它需要包含一个名称
Rouge::Formatters 命名空间下的常量。

注意:格式化程序类需要响应 ::new(opts),其中 opts
是选项的哈希值,并且 #format 需要返回 HTML
格式化源代码。

disable 如果设置为 true,则将禁用 Rouge 突出显示。
可能不应该全局设置,而应该在“跨度”或“块”内部设置
选项。

span 选项的键值映射,仅在语法时使用
突出显示代码跨度。块选项的键值映射
仅在语法突出显示代码块时使用。此外,所有胭脂
选项(例如“line_numbers”)可以直接在
'syntax_highlighter_opts' 选项(它们适用于代码跨度和
代码块)和/或“span”/“block”键上。

Maybe this is what you are looking for?

The Rouge syntax highlighter supports the following keys of the option
‘syntax_highlighter_opts’:

default_lang The default language that should be used when no language
is set. guess_lang If no specific language or a default language is
set, guess the language. formatter A custom Rouge formatter class that
should be used instead of the following default formatter (Rogue 1.x:
Rouge::Formatters::HTML / Rogue 2.x: Rouge::Formatters::HTMLLegacy).
If this setting is a string, it needs to contain the name of a
constant under the Rouge::Formatters namespace.

Note: The formatter class needs to respond to ::new(opts), where opts
is a hash of options, and to #format which needs to return the HTML
formatted source code.

disable If set to true, highlighting with Rouge will be disabled.
Should probably not be set globally but inside the ‘span’ or ‘block’
options.

span A key-value map of options that are only used when syntax
highlighting code spans. block A key-value map of options that are
only used when syntax highlighting code blocks. Furthermore all Rouge
options (e.g. ‘line_numbers’) can be set directly on the
‘syntax_highlighter_opts’ option (where they apply to code spans and
code blocks) and/or on the ‘span’/’block’ keys.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文