Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 代码块高亮失效 #419

Closed
1 task done
shenjackyuanjie opened this issue Dec 2, 2023 · 4 comments
Closed
1 task done

[Bug]: 代码块高亮失效 #419

shenjackyuanjie opened this issue Dec 2, 2023 · 4 comments
Labels
🐞 bug Something isn't working

Comments

@shenjackyuanjie
Copy link

shenjackyuanjie commented Dec 2, 2023

版本信息

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 57.98 GB / 95.91 GB
  Browsers:
    Edge: Chromium (119.0.2151.93)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    rspress: ^1.7.5 => 1.7.5

问题详情

如题,代码高亮失效
实际案例:
https://f2ac97ec.nuitka.pages.dev/main/lib-not-dr/readme.html#nuitka-compiler-helper

下方的几个代码块无论有无 title 代码块高亮均失效

复现链接

https://f2ac97ec.nuitka.pages.dev/main/lib-not-dr/readme.html#nuitka-compiler-helper

复现步骤

https://f2ac97ec.nuitka.pages.dev/main/lib-not-dr/readme.html#nuitka-compiler-helper
源码:
shenjackyuanjie/nuitka-shenjack@5a47c86
使用 CF pages 部署
无框架

相关 issue

  1. need reproduction 🐞 bug
@shenjackyuanjie shenjackyuanjie added the 🐞 bug Something isn't working label Dec 2, 2023
@chenjiahan
Copy link
Member

Rspress 只内置了一部分语言的 highlight 样式(为了减少包体积)

py 和 toml 可以用这个选项来开启高亮:https://rspress.dev/zh/api/config/config-build.html#markdownhighlightlanguages

后续我们会在文档里加一些相关提示 😄

@chenjiahan
Copy link
Member

更好的解决方案是自动分析 markdown 里使用的代码块语言,并生成 highlight 配置。

mdx-rs 可以分析并提供对应的元数据,供 rspress 消费。

@shenjackyuanjie
Copy link
Author

感谢!

@sanyuan0704
Copy link
Collaborator

sanyuan0704 commented Dec 3, 2023

更好的解决方案是自动分析 markdown 里使用的代码块语言,并生成 highlight 配置。

mdx-rs 可以分析并提供对应的元数据,供 rspress 消费。

这个可以实现,不过放在 loader 层面来做不太合适。我想可以放在 Rspack 编译之前用 mdx-rs 扫描一遍用到的代码块语言,然后自动生成 highlight 配置。 #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants