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.

Post History

66%
+2 −0
Meta Is there a workaround to highlight code blocks if the language doesn't have syntax highlight enabled?

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 i...

0 answers  ·  posted 3y ago by hkotsubo‭  ·  edited 9mo ago by hkotsubo‭

#3: Post edited by user avatar hkotsubo‭ · 2024-03-18T12:24:24Z (9 months ago)
  • I've seen that recently two requests to add syntax highlight to some languages were deferred ([this](https://software.codidact.com/posts/279676) and [this](https://software.codidact.com/posts/283059)).
  • According to the [status-deferred tag description](https://software.codidact.com/categories/39/tags/3290): "*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 circustances). 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?
  • I've seen that recently two requests to add syntax highlight to some languages were deferred ([this](https://software.codidact.com/posts/279676) and [this](https://software.codidact.com/posts/283059)).
  • According to the [status-deferred tag description](https://software.codidact.com/categories/39/tags/3290): "*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 &mdash; for example, a mass edit might be required to revert the workaround.
  • Is there another alternative? Another pros and cons to the above?
#2: Post edited by user avatar hkotsubo‭ · 2021-08-23T19:35:04Z (over 3 years ago)
#1: Initial revision by user avatar hkotsubo‭ · 2021-08-23T17:56:39Z (over 3 years ago)
Is there a workaround to highlight code blocks if the language doesn't have syntax highlight enabled?
I've seen that recently two requests to add syntax highlight to some languages were deferred ([this](https://software.codidact.com/posts/279676) and [this](https://software.codidact.com/posts/283059)).

According to the [status-deferred tag description](https://software.codidact.com/categories/39/tags/3290): "*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 circustances). 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?