代码未在GitHub页面上突出显示

发布于 2025-02-10 02:09:52 字数 767 浏览 2 评论 0 原文

我使用 jekyll的最小主题

我正在Markdown中写下页面。在我的_config.yml文件中,我有选项:

markdown: kramdown
highlighter: rouge
kramdown:
    input: GFM
    syntax_highlighter: rouge

以某种方式,代码并未突出显示: https:/> https:/ /sergedmi.github.io/pages/arccos

请注意,最小主题确实包含

该代码在github中正确突出显示:

有技巧吗?

I created a github page, using jekyll's minimal theme

I'm writing the pages in markdown. In my _config.yml file, I have the options :

markdown: kramdown
highlighter: rouge
kramdown:
    input: GFM
    syntax_highlighter: rouge

Somehow, the code is however not highlighted : https://sergedmi.github.io/pages/arccos

Note that the minimal theme does contain a css stylesheet that should highlight the code according to rouge markup.

The code is correctly highlighted in github : https://github.com/SergeDmi/SergeDmi.github.io/blob/master/pages/arccos.md

Any tip ?

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

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

发布评论

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

评论(1

独闯女儿国 2025-02-17 02:09:52

更新的答案

我相信修复程序是将 c ++ 更改为 cpp 在您的标记代码块中。

这是我测试修复程序的方式。

  1. jekyll new CPP检验
  2. 将配置添加到自动生成的 _CONFIG.YML 用于使用 rouge 用于代码块语法突出显示。
markdown: kramdown
highlighter: rouge
kramdown:
    input: GFM
    syntax_highlighter: rouge
  1. 在新中运行 Jekyll S CPP检测目录

渲染

c ++ 的样子

这是 cpp 的样子

原始答案

是您需要在Markdown代码块中使用 CPP 而不是 C ++

如果您将 C ++ cpp 切换,则GitHub将语法突出显示您的代码块相同。

Rouge文档C ++为 cpp 此处 https ://github.com/rouge-ruby/rouge/blob/master/docs/languages.md

Updated Answer

I am confident that the fix is to change C++ to cpp in your Markdown code blocks.

Here is how I tested the fix.

  1. jekyll new cpp-test
  2. Add the configuration to the auto-generated _config.yml to use rouge for code block syntax highlighting.
markdown: kramdown
highlighter: rouge
kramdown:
    input: GFM
    syntax_highlighter: rouge
  1. Run jekyll s in new cpp-test directory

Rendering

Here is what it looks like with C++
C++ example

Here is what it looks like with cpp
ccp example

Original Answer

Could it be that you need to use cpp instead of C++ in your Markdown code blocks?

It looks like GitHub will syntax highlight your code blocks the same if you switch C++ to cpp.

Rouge documents C++ as cpp here https://github.com/rouge-ruby/rouge/blob/master/docs/Languages.md.

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