Syntax Highlighing: Awk code unreadable (highlight.js)

Hi,
awk code like the following is only readable in the dark schemes.
In the light schemes (like Minima or Graceful) it becomes dark grey on black background, and is hardly readable.
I tested with Safari and Chrome on IOS and Android.

This is unreadable with light schemes.
3 Likes

Yes, good catch. I wonder how we fix that.

I've noticed the same, yes. It used to be fine on the Light theme (which is what I use as well), with colours and syntax highlighting and whatnot. But a little while ago it changed to very-dark-gray on a nearly-black-background, and became unreadable as a result. That's why I've gone back to putting everything in "[CODE]" tags again, since it's the only way I can actually read anything.

You can report theme issues with Discourse here:

Discourse is open source and therefore Discourse related bugs can be reported at the official Discourse support site above.

If we start modifying these themes, we will have to fork them and support them on our own; so it is best to seek support from Discourse.

Also, when reporting visual issues, screen shots are advised.

HTH

Removing awk from the list of supported syntax seems to "fix" this:

So, it seems the issue is with the either the syntax highlighter and / or the light themes for the "awk" syntax, so please do not use this as it has been disabled (above)

```awk
```

You can use the above, but it will have no effect since it is disabled (removed from the list) in the settings.

My best guess without digging into the code is that the awk syntax highlighting used by Discourse has a problem, because when I disable it the problem goes away.

I have no plans to spend any additional time debugging this particular syntax highlighter issue.

Hope this helps.

FWIW, I use this for most unix-like command-line code:

```bash
```

or

```shell
```

... but you can eithe rshell or bash (or another syntax tag) and see if these syntax highlighters works for you.

If you wish to dig further, please check out this documentation:

https://highlightjs.org/static/demo/

See also:

Members can file update requests, feature requests of "bugs" here:

You might consider posting an issue here:

Syntax highlighting is performed by highlight.js which is a part of the core Discourse code base.

Cheers.

See Also:

As this code is open source, anyone can suggest changes to the code and contribute to development.

My "best guess" is that few people use awk syntax highlighting, so it's not well developed. Anyone who loves awk is of course free to improve it's syntax highlighting.

See Also:

Documentation

https://highlightjs.readthedocs.io/en/latest/

Contributors

See Also

highligher.js (awk.js)

Thank you Neo!

@neo......I'd be more than happy to post the problem at Discourse if I thought that I could adequately describe it.

Do I just say "awk highlighting is not clearly visible if the user is using a light theme"?

Hi @hicksd8,

It would be best if you could use the developer console in your favorite browser and identify the exact CSS and id/class of the HTML element.

Normally developers need the HTML element (class or id) in the DOM to troubleshoot.

This info can be easily ascertained in the browser development console by highlighting the element, right click, and then Inspect option.

This will bring up the browser console and the elements tab and the info is there (plus you can test and double check by changing the attributes of the element in the console).

On the other hand, OTTOMH, when I did a quick look earlier this AM, it seemed to me that the awk syntax highlighter is very primitive and not really something "so great" as to take any action but to disable it,

From a quick review, the awk syntax highlighter seemed "not well developed" so my thought was to just disable it on our site; however, if folks think that it really has added value (the awk syntax highlights), then let's definitely look into getting it fixed.

When you have the exact HTML element, you can search the source code repos(s) to find an exact match, which will help the trip down the rabbit hole on this small issue.

Do you want me to reenable the awk syntax hi-lighting for now or leave it (off) as-is?

I'm totally neutral on this, tbh, since I only use dark themes these days and do not use the awk syntax highlighter feature in Markdown ( typically I highlight in shell or bash for this type of code) or (of course) ruby for Ruby code, etc. etc.

Please leave it off!!

1 Like

OK! :slight_smile:

You are welcome.

If you see any more of this same issue with certain highlighters and the light themes, please post back here and we can disable them for now and keep track of them, as so far we have disabled (removed) only the following from syntax highlighting support:

  • awk

Here is the current list, again:

1 Like