denoland / deno-gfm

Server-side GitHub Flavored Markdown rendering for Deno
https://jsr.io/@deno/gfm
MIT License
221 stars 33 forks source link

Replace Prism with starry-night #56

Open kidonng opened 1 year ago

kidonng commented 1 year ago

starry-night is a syntax highlighter with feature parity to GitHub, which makes it an interesting alternative to currently used Prism. And styling is free if #55 is accepted.

lino-levan commented 1 year ago

Looks interesting. What are the performance implications? What are the advantages over what we currently have? Given that this is a big breaking change, we should consider doing #55 at the same time (if we choose to do so, as I said there I am a little -1 on it).

kidonng commented 1 year ago

What are the performance implications?

It's by remark author so I would not worry too much about that.

What are the advantages over what we currently have?

Given that this is a big breaking change, we should consider doing #55 at the same time

It's a breaking change for good. And this is intended after #55, or else it would need to import styles from starry-night.

lino-levan commented 1 year ago

We determined in #67 that starry night is too slow for default usage here. We might be able to still use it if we have a toggle between "fast but bad" vs "good but slow".

kyeotic commented 8 months ago

Since YAML parsing is still broken, I would very much appreciate such a toggle

lino-levan commented 8 months ago

@hashrock opinions on a toggle here?

deer commented 8 months ago

Hi guys, please take a look at my PR https://github.com/denoland/deno-gfm/pull/96 which solves the yaml issue. (Or at least it tries to -- please let me know if it's not working as expected!)

kyeotic commented 8 months ago

I don't want to say I don't care about performance at all, because if the page took 20 seconds to load it would be a dealbreaker. If it takes 2 seconds to load a page with bullerproof syntax highlighting that matches GitHub exactly, though, I'm good with that.

I care way more about accuracy than performance for a blog. Looking at all the YAML blocks with only two colors, and most of them wrong, is aggravating.

I just spent 2 hours trying to move to Starry Night myself, but got so caught up trying to match the the styling that is spread between UnoCSS, gfm, and the syntax css that I gave up. I'll probably take another crack soon, because after seeing what Starry Night can I don't see any point to Prism anymore. Who cares if its faster when it renders the wrong thing?

lino-levan commented 8 months ago

I've used Starry Night extensively in Pyro. The performance in real-world code snippets is very tolerable (sub 100 ms for a whole page). The performance on arbitrary code snippets (minified code or 1000+ lines of code) is rather slow. I think for personal blog posts or documentation where the code snippets are known a priori, starry night works great.

You can check out working YAML using starry night at https://pyro.deno.dev/getting-started/configuration/.

kyeotic commented 8 months ago

Yeah, that looks perfect. I'm not yet ready to move to a different platform, but if getting Starry Night working with deno-gfm/deno_blog ends up being too much work I will give Pyro a look.

lino-levan commented 8 months ago

Pyro was just an example use of Starry Night, it's really great for nice looking code snippets. I do not recommend Pyro for blogs just yet. I'm +1 for having a config option for starry night. What are your thoughts hashrock?

hashrock commented 8 months ago

yeah +1 for having a config option

kyeotic commented 8 months ago

If you do add a config option, please include all vs common for the Starry Night language selection.