Hi, excuse me if this already exists, but could we have a means of syntax-highlighting code that is tailored to the forum that it's posted on, and optionally an author-specified language. I.e. on the C forum, the highlighing would be heavily tailored to highlight C code. You get the idea I'm sure.
I've noticed very marginal highlighting over on the Assembly forum which makes code harder to read - especially since certain languages (cough assembly cough) can sometimes be messy in themselves without the syntax highlighting messing things up further.

Cheers

Recommended Answers

All 10 Replies

If code is hard to read it ie either because of

  1. the language
  2. the programmer

Some languages (APL, Perl) make it very easy to write unreadable code. Other languages make it slightly less easy but a programmer who lacks a decent style will write difficult-to-read code regardless of whatever syntax highlighting is available. I expect that providing a parser for all the languages for which separate forums exist would not be worth the effort. Well written code needs no highlighting to make it readable. Poorly written code would not be improved by it.

could we have a means of syntax-highlighting code that is tailored to the forum that it's posted on

This currently exists and is in place.

optionally an author-specified languag

There are no current plans for this, sorry. We tried playing around with it last year but found the Markdown syntax support to be buggy at best.

I've noticed very marginal highlighting over on the Assembly forum which makes code harder to rea

We currently use Prettify to handle our syntax highlighting. Unfortunately, Assembly is not one of its supported languages.

We currently use Prettify

I take it there's no way to add a new language syntax with Prettify?

There is. A recent discussion on SO meta shows that there is no such package yet, and that it's problematic to make because of all the different constructs for different processors. They state correctly that just highlighting the opcode is not really useful.

I'm kind of in agreement with the OP here.

Assembly code is hard to read at the best of times and the way it's highlighted by Prettify only makes it worse.
The way the highlighting catches your attention can artificially subset pieces of code and you have to be aware of needing to undo something your brain tends to do automatically. This is especially bad if you've been working recently in more common syntax languages ;)

My personal opinion is of removing all syntax highlighting from Assembly. (Essentially an extension that does nothing)

I'm open to doing that, but my first choice would be for someone way smarter than I to create an Assembly definition for Prettify.

Sorry, missed pritaeas's post :(

So should I just remove all syntax highlighting from asm??

should I just remove all syntax highlighting from asm??

That's a good idea. I vote yes.

should I just remove all syntax highlighting from asm??

I second this.

Syntax highlighting has been removed from the assembly forum moving forward.

Removing it retroactively would involve repopulating the cache and doing so is very costly, so I want to avoid doing that until I need to do it for another reason at the same time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.