-
Notifications
You must be signed in to change notification settings - Fork 991
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
Allow user to add custom highlighting themes #419
Comments
I'm not entirely against that but I would rather have as many themes as possible in Gutenberg. Custom syntaxes make sense because some people are developing their own language but it's not the case really for themes. |
There are a great many themes out there, that came about because people do develop their own themes. I interact with more people that I know have modified text editor themes or written themes from scratch than I know have written syntax highlighters. (I’ve done all three many times over.) I think this variation may actually be a bigger deal for websites than for text editors: in the text editor the theme exists in relative isolation, but inside Zola syntax highlighting exists inside the rest of the site theme. The likes of Zola attract power users that care about such details. In my own fork of Zola (I’m sure to want other variations of stock functionality), I’m going to need to do this. I believe that syntax highlighting themes should be part of the regular theme system. I don’t think that’s too radical a notion. If you want something more radical, I believe that including any highlighting themes out of the box is a misfeature—just as no site themes are included out of the box. There are decent repositories of TextMate themes out there already, and it’s easy to drop the .tmTheme.txt file in. |
If someone wants to send a PR, code changes can probably almost follow the syntax changes. In the
I disagree on that, it would make syntax highlighting unusable without going on some random websites. |
Correct, it would make syntax highlighting unusable without work. But Zola already requires you to find or make a theme; that’s why I don’t consider it as outlandish as all that, merely fairly radical. |
It also requires you to write some content :) |
Would be great to actually be able to just specify a location with Sublime Text highlighting configuration and have that theme added automagically, much like it's done currently with ST syntaxes. |
I'd like to have a go at implementing this. I've looked at how bat does it for inspiration and it seems easy https://github.com/sharkdp/bat/blob/master/src/assets.rs Kudos to syntect's author for all the convenience functions! As a user, with bat, adding a theme is as simple as: |
Any updates on this? I'd to modify the syntax colors with sass variables but don't know if that's possible somehow |
That wouldn't be possible with that feature still. After #1242 you could create some class in your scss files and it should work. |
Sorry I've not even made a start on this, but it is still something I want to find time for! |
I started this in earnest today. It is a little tricky because storing the ThemeSet is difficult. I briefly tried storing a reference to it but that quickly ran into lifetime issues. So now I'm thinking of using Something like
Would that be agreeable? It's not a direct dependency, but some dependencies depend on it. Could even move extra_syntax_set out of Config to a static as well for consistency. Using it would look something like
I assume this is safe to unwrap because Site::new() is only called once (per run) but I might be wrong to assume that! |
I'm completely wrong to assume that. I've got something that works... the first time it builds a site. |
Related to getzola#419 Introduces once_cell dependency to store extra SyntaxSet, ThemeSet as statics. Option<SyntaxSet> is no longer stored in the Config Markdown struct. Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Now I have something working, it won't be able to "reload" extra highlighting themes without running serve again, but it works :) |
Related to getzola#419 Introduces once_cell dependency to store extra SyntaxSet, ThemeSet as statics. Option<SyntaxSet> is no longer stored in the Config Markdown struct. Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Introduces once_cell dependency to store extra SyntaxSet, ThemeSet as statics. Option<SyntaxSet> is no longer stored in the Config Markdown struct. Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Introduces once_cell dependency to store SyntaxSets and ThemeSets as statics. Option<SyntaxSet> is no longer stored in the Config Markdown struct. Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to #419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
Related to getzola#419 Gruvbox tmTheme added to test_site, it is taken from https://github.com/Colorsublime/Colorsublime-Themes (MIT licensed)
It would be great if users couldn't just add custom highlighting syntaxes (possible since 0.4.2) but also custom highlighting themes without the need to add them to gutenberg itself.
The text was updated successfully, but these errors were encountered: