Skip to content
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

[Feature request] Use class instead style #36

Open
zyxkad opened this issue Mar 25, 2023 · 2 comments
Open

[Feature request] Use class instead style #36

zyxkad opened this issue Mar 25, 2023 · 2 comments

Comments

@zyxkad
Copy link

zyxkad commented Mar 25, 2023

Why should we use class, not hard code style:

  • Dark themes are more popular now, people doesn't only like light theme. class can ensure people are using their perfect theme.
  • Free Configuration. We can customize many fun themes in our css file either.
  • Security. Style is more easier to get XSS attack, so things like bluemonday will clear the style and none highlighted codes will be send to the client
@Yuelioi
Copy link

Yuelioi commented Apr 24, 2024

hI, you can use cutom configuration, goldmark-highlighting is base on https://github.com/alecthomas/chroma, so you can

goldmark.New(
  goldmark.WithExtensions(
    highlighting.NewHighlighting(
	  highlighting.WithStyle("base16-snazzy"),
        highlighting.WithFormatOptions(
					chromahtml.ClassPrefix("highlight-"),
					chromahtml.WithClasses(true),
					chromahtml.LineNumbersInTable(true),
					chromahtml.WithAllClasses(true),
					chromahtml.WithLineNumbers(true),
				),
			),
		),
	)

@rcarmo
Copy link

rcarmo commented Oct 8, 2024

This should be in the README, I don't think anyone wants hard-coded colors anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants