theme-particlex / hexo-theme-particlex

A concise Hexo theme, based on Particle.
MIT License
410 stars 56 forks source link

如何正确识别代码语言? #121

Open SunsetGlow95 opened 1 month ago

SunsetGlow95 commented 1 month ago

我在博客中加入了插件 hexo-markdown-it-plus,然后代码语言都被识别为 highlight……

LynxCatTheThird commented 4 weeks ago

请仔细阅读并充分理解 Hexo 和 hexo-renderer-markdown-it-plus 的文档,检查 hexo-renderer-markdown-it-plus 的配置,而不是仅仅 Ctrl+C/V。

尝试调节某个类似于 langPrefix: 'language-' 或者 pre_class: highlight 的配置项,看是否有效果?


Btw,hexo-renderer-markdown-it-plus@upupminghexo-renderer-markdown-it-plus 均已停止维护,建议切换至更可靠的 Renderer。

SunsetGlow95 commented 4 weeks ago

请仔细阅读并充分理解 Hexo 和 hexo-renderer-markdown-it-plus 的文档,检查 hexo-renderer-markdown-it-plus 的配置,而不是仅仅 Ctrl+C/V。

尝试调节某个类似于 langPrefix: 'language-' 或者 pre_class: highlight 的配置项,看是否有效果?

Btw,hexo-renderer-markdown-it-plus@upupminghexo-renderer-markdown-it-plus 均已停止维护,建议切换至更可靠的 Renderer。

谢谢/wul。本人写 C++,这两个调节为空或此值均会出现语言识别为 highlightlang-cpp,并且头文件被吞的情况。将主题更改为 fluid 后和 markdown-it-plus 搭配会把默认语言改为德语(这啥玩意),再强制设置语言为 zh-CN 即可正常渲染。所以在本主题下提出 issue,因为相同的配置只有此主题会出现这样的情况(其他如 nebula 等主题也可以正常 highlight)。不过的确有可能是我没仔细阅读文档的问题/wul

argvchs commented 3 weeks ago

目前 particlex 推荐的渲染器是 hexo-renderer-pandoc,不保证使用其他渲染器时的渲染效果