Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Is there a workaround to highlight code blocks if the language doesn't have syntax highlight enabled?

+2
−0

I've seen that recently two requests to add syntax highlight to some languages were deferred (this and this).

According to the status-deferred tag description: "the requested feature will not be implemented in the near future".

From that description, my understanding is that there's not a timeline defined, and perhaps no guarantee that this will be made at all.

While we wait/hope for it, what's the workaround for highlighting code blocks with those languages? I can think of two alternatives:

  • leave the post as is, and when/if highlight for that language is added, no change will be needed. IMO, it's bad because the code won't be highlighted until support for the language is added (which can possibly mean "forever").
  • change the code block to use some language that has syntax highlight enabled and is "close enough" to the block's original language. IMO, it's "good" because at least the code will have some highlight (not-so-accurate may be better than nothing). I'm not sure if this affects the site's "semantics", as the blocks will have a CSS class with the wrong language in its name (not to mention the need to revert those if highlight for the original language is added).

While there are few posts containing code with the languages involved, option 2 seems to be the best alternative (not ideal, but good enough considering the circumstances). But as the site grows, this has the possibility to become a burden — for example, a mass edit might be required to revert the workaround.

Is there another alternative? Another pros and cons to the above?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

You could try doing it manually, I suppose.... (3 comments)

0 answers

Sign up to answer this question »