cinny icon indicating copy to clipboard operation
cinny copied to clipboard

Codeblock syntax highlighting

Open ghost opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

It's kind of annoying when somebody posts code in a codeblock and there's no syntax highlighting.

Element: element

Cinny: cinny

Github:

package main

import "fmt"

func main() {
	fmt.Println("hello world")
}

Describe the solution you'd like

Implement some type of syntax highlighting for codeblocks.

Additional context

I've heard highlight.js is popular https://github.com/highlightjs/highlight.js/

ghost avatar Feb 20 '22 11:02 ghost

highlight.js is really bloated and just overall awful to use. Prism is a much better choice. I already made an implementation a while ago using Prism, but did not know which colors to go for (keywords, strings, etc.).

ginnyTheCat avatar May 12 '22 21:05 ginnyTheCat

I mean, anything is better than nothing. It can always be changed later if it's ugly

deanveloper avatar May 13 '22 03:05 deanveloper

highlight.js is really bloated and just overall awful to use. Prism is a much better choice. I already made an implementation a while ago using Prism, but did not know which colors to go for (keywords, strings, etc.).

We can use css variable for color? Which will be good to change code colors based on theme.

ajbura avatar May 15 '22 04:05 ajbura

We can use css variable for color?

Someone made a Prism theme with CSS variables here, https://github.com/antfu/prism-theme-vars

natsukagami avatar May 05 '23 14:05 natsukagami