highlightjs / vue-plugin

Highlight.js Vue Plugin
BSD 3-Clause "New" or "Revised" License
207 stars 27 forks source link

Many different kinds of elements just don't have styles attached to them #48

Open fabricepallaud opened 11 months ago

fabricepallaud commented 11 months ago

No matter the theme I select, some elements like .hljs-function, .hljs-params, .hljs-property among others just don't have styles attached to them hence must be styled manually.

Screenshot_29

Is it normal?

joshgoebel commented 11 months ago

No matter the theme I select

I'd say you're having some bad luck perhaps - check the source files here and you'll see these scopes are definitively present in SOME themes. But more specifically:

.hljs-property

https://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#a-note-on-newer-scopes

.hljs-function

This has fallen out of favor vs the new title-function scope - though many themes just alias both scopes to the same color... (for backwards compatibility)

.hljs-params

This has also fallen out of favor because it's often used as a block scope and just thrown around () which can look pretty bad. Some new grammars don't even try to figure out where params starts and ends and just match patterns to highlight any interesting elements there - just like anywhere else in the code.


I don't think there is any sign of a real problem here. If anything adding property (as part of #2500) might be a priority but it's hard to find theme maintainers and just anyone coming in and adding random colors to existing themes to cover new scopes is kind of a hard thing to do. If someone had a generic proposal dealing with how to handle this is some type of automated fashion that could be interesting though.

fabricepallaud commented 11 months ago

Got it, thanks! I just styled these elements myself which was quick and easy anyway.