Is syntax highlighting enabled on these forums and for which languages?

Continuing the discussion from Please, using same home partiion between opensuse and new installed mint:

From this link:

The language must be one of the highlighted languages configured for syntax highlighting on your site.

So, which languages are configured on this site? :slight_smile:

We have the value set to default, which is all the languages from Demo - highlight.js

It does not match my observations. As a trivial example - code in Unable to create initial ram filesystem, cannot boot - #34 by 40476
It is entered as preformatted text without explicit format indication ( forums.opensuse.org/raw/179392/34), so should be auto-detected. When I paste the same lines on this demo site, it is detected as XQUERY and highlightend. But not on the forum:

And yes, auto-detection is wrong in this case, but that is not the point :slight_smile:

I’ve always added manually… eg “bash or yaml etc” just habit…

If it helps, that text I pasted was from my terminal (zypper, dracut, and zsh.) I do not understand why you would need syntax highlighting for that or how you would autodetect that from a terminal, which can vary wildly in color depending on the application, not to mention the ever increasing number of packages that may or may not have colored output.

@40476 It’s not about what is in your terminal, but how it’s presented here. Look at a markdown reference book on what can be done…

I see, my argument is this : “Is it viable to attempt to autodetect a programs coloring with no knowledge of its parent program?” Such as in zypper, where posttrans and installation script outputs are a darkened cyan color, (in Konsole.) I am not excluding the overview screen at the beginning of an install/update or the errors that occur during download, I understand that, since it may be possible. But how can we be sure which program we are getting text from if the user does not specify the command or the programs name?

In my experience, unless explicitly stated in the way discourse expects (see images,) discourse does not apply syntax highlighting .

On beginning line:
Screenshot 2024-10-16 at 10.32.11 AM.png

After beginning line (must be first line), this method is somewhat hit and miss as only certain program directories seem to be recognized.
Screenshot 2024-10-16 at 10.34.06 AM.png

The problem with discourse’s solution is that most users either don’t know about this feature or don’t care. Which is what I perceive this other idea to be attempting to solve. I just don’t see a viable way through this.

Which directly contradicts to the reply I got and the Discourse article that was referenced. I just wanted to know how it is works in this Discourse instance.

@arvidjaar I’ve seen it work, but as indicated by @40476 screenshots is what I use.

1 Like