vala-lang / vala-www

Website of the Vala programming language
https://vala.dev
Creative Commons Attribution Share Alike 4.0 International
49 stars 22 forks source link

Code example displays incorrectly when JavaScript is unavailable #81

Closed colinkiama closed 2 years ago

colinkiama commented 2 years ago

The code example relies on prism.js for formatting and highlighting. When it's not available, here's what the home page looks like: Screen Shot 2022-06-21 at 21 27 39

If a fix can't be found, the code example should be hidden and the global header should have the "diagonal slice" effect when JavaScript is off.

naipotato commented 2 years ago

Uh, this is too far from what I expected. In the previous version of the site, when JavaScript was not available, the code simply lost its highlighting, it didn't break the layout.

pervoj commented 2 years ago

We can make the highlighting done with Zola. I've already done something similar on my website: https://github.com/pervoj/website/tree/main/syntaxes

It needs to add a line to Zola config: https://github.com/pervoj/website/blob/main/config.toml#L15

colinkiama commented 2 years ago

Uh, this is too far from what I expected. In the previous version of the site, when JavaScript was not available, the code simply lost its highlighting, it didn't break the layout.

Yeah, there's probably something wrong with the way I implemented it then.

colinkiama commented 2 years ago

We can make the highlighting done with Zola. I've already did something similar on my website: https://github.com/pervoj/website/tree/main/syntaxes

It needs to add a line to Zola config: https://github.com/pervoj/website/blob/main/config.toml#L15

Is there a page on your website there is a Vala code block?

pervoj commented 2 years ago

We can make the highlighting done with Zola. I've already did something similar on my website: https://github.com/pervoj/website/tree/main/syntaxes

It needs to add a line to Zola config: https://github.com/pervoj/website/blob/main/config.toml#L15

Is there a page on your website there is a Vala code block?

Currently not, but it's just syntax highlighter copied from the Vala Sublime Text plugin. It uses the Zola higlight theme.

pervoj commented 2 years ago

I found out one thing: Zola supports highlighting only in .md files.

colinkiama commented 2 years ago

If loaded markdown content was passed through the markdown filter would the highlighting still work?

It also looks from the syntax_highlighting docs, highlight_themes_css will allow us to continue using a separate light and dark theme for syntax highlighting.