kristoff-it / zine

Fast, Scalable, Flexible Static Site Generator (SSG)
https://zine-ssg.io
515 stars 23 forks source link

Fails to build if markdown code block has unrecognized language #46

Open MatthiasPortzel opened 1 month ago

MatthiasPortzel commented 1 month ago

When trying to build a markdown file with a language unsupported for syntax highlighting, e.g.

```ld
hello world

zine throws an error. Since this is valid markdown, I would expect it to be rendered even if it can't be syntax highlighted. Instead it tries to detect the syntax and then errors when it cannot; this bit of code:
https://github.com/kristoff-it/zine/blob/ebd8796f4a1c20c938693431aa638fbaa35a9fe4/src/highlight.zig#L55
kristoff-it commented 3 weeks ago

Erroring out when not recognizing the language is by design, if you need a new language added to Zine find (or write) the relative Tree Sitter grammar and we'll add it to the list.

I think right now file extensions are not getting picked up by Zine; if that's actually the case then it should be implemented.

In the future we should also implement a way to let users bring their own syntax highlighter, but it will be a while before we get there.

Leaving this open until the file extension stuff is confirmed and implemented if needed.