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

[Feature]: hf社区主题可以使用本地代码高亮吗? #1695

Open
oreeke opened this issue Apr 9, 2024 · 1 comment
Open

[Feature]: hf社区主题可以使用本地代码高亮吗? #1695

oreeke opened this issue Apr 9, 2024 · 1 comment

Comments

@oreeke
Copy link
Contributor

oreeke commented Apr 9, 2024

Class | 类型

程序主体

Feature Request | 功能请求

现在好像只有已经本地化的主题支持代码高亮。

@oreeke
Copy link
Contributor Author

oreeke commented Apr 10, 2024

@binary-husky 我直接把default.css扔到gradios.py,--background-fill-primary: #050810;注释掉
复制一个default.css重命名,根据需要增减样式,再从gradios.py引用,就可以把本地样式传染给社区主题了
这样沿用了本地default处理markdown或highlight的独特样式,大部分样式还是社区原样

  • gradios.py
with open(os.path.join(theme_dir, "common.css"), "r", encoding="utf-8") as f:
    advanced_css = f.read()
with open(os.path.join(theme_dir, "default_hf.css"), "r", encoding="utf-8") as f:
    advanced_css += f.read()

屏幕截图 2024-04-10 211704

但这只是简单粗暴的方法,如果能自动筛选本地和远程样式才完美,暂时没想到好办法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants