80 votes

Please update the Google Prettify syntax-highlighting library

Stack Overflow should start its own fork of code-prettify, or move to a different solution. Most pull requests don't get reviewed or merged in the Google repository anymore. There are more missing C# ...
Cœur's user avatar
  • 37.3k
74 votes
Accepted

Should we approve suggested edits that change ``` to four spaces code formatting or vice versa?

No. Edits like those should be rejected for not making a meaningful improvement or making the post easier to read. Edits that only change formatting are appropriate in very narrow circumstances, such ...
elixenide's user avatar
  • 44.3k
56 votes
Accepted

Is serially editing posts to include syntax highlighting helpful?

I'm strongly in favour of edits like this. Syntax highlighting, tab-size consistency and wrapping to avoid horizontal scrolling can make a significant difference to the legibility of a code sample — ...
Owen Blacker's user avatar
  • 4,117
53 votes

How does the highlight.js change affect Stack Overflow specifically?

My recommendation: If you know the language, go ahead and explicitly set it. Even on posts where the question includes exactly one language tag? So far, language tags overrode the heuristic for ...
Konrad Rudolph's user avatar
29 votes

Should we approve suggested edits that change ``` to four spaces code formatting or vice versa?

No. These types of edits should be rejected, especially now that this type of formatting actually results in proper code formatting, and not half-broken formatting. These types of edits make ...
Zoe's user avatar
  • 27.1k
25 votes

C++ tag variants do not highlight syntax

Braiam is right: the solution here is to tag all questions with the c++ tag, and then you'll automatically get syntax highlighting appropriate for the C++ tag. This is just another special case of ...
Cody Gray - on strike's user avatar
24 votes
Accepted

Why isn't there support for Visual Basic syntax?

There is support for VB syntax highlighting: Dim text As String = "Hello, World" 'The text variable holds Hello, World Questions where the only language tag is vb.net or vba should highlight ...
BoltClock's user avatar
  • 702k
24 votes
Accepted

What should we expect from syntax highlighting auto-detection?

There are 2 main parts to this: When highlight.js is used to detect a language, if it is given no constraints on languages to choose from, it will choose the language that results in the most ...
CertainPerformance's user avatar
23 votes
Accepted

Revert new syntax highlighting

Based on this overwhelming feedback, I reverted the colors from the other day, though I did slightly brighten the previous "maroon" color that was being used just to help differentiate from black. The ...
Hynes's user avatar
  • 3,394
22 votes
Accepted

'get' in a code tag does not render properly as a keyword

That is a bug in the Prettify highlighter, and unfortunately bugs should be reported on their GitHub project, as explained in What is Syntax highlighting and how does it work?. I went ahead and made ...
rene's user avatar
  • 41.5k
22 votes

Shell: make prompt # and $ uncopiable

Honestly, this is a terrible idea all-around. The devs would have to deal with questions like: How would you tell that it's bash? In many languages, $ is usable in variable names and # means a ...
Nissa's user avatar
  • 4,636
20 votes

Add syntax highlighting language for diff

Since Stack Overflow has migrated to highlight.js and there is a diff highlighter (search for "diff" on the website) available for that tool, I wonder why it is still unsupported on SO. It ...
kriegaex's user avatar
  • 63.3k
20 votes
Accepted

How to compose yellow background blockquote?

This is a standard blockquote. The Markdown syntax is to precede the text with a >. You can achieve the same effect in the editor by highlighting the block of text and clicking the quotation-mark ...
Cody Gray - on strike's user avatar
20 votes
Accepted

Is the following HTML comment necessary?

This edit added syntax highlighting to the code blocks. (This makes different parts of the code change color based on its function: upper case words are one color, numbers another, and keywords a ...
Laurel's user avatar
  • 5,985
20 votes
Accepted

Syntax highlight apparently broken in edit preview and suggested edits queue

We managed to tackle the issue and disable the temporary fix we put in some time ago. The problem boils down to conflicts between the diff highlighting and the syntax highlighting - because of those ...
marrados's user avatar
  • 101
20 votes

How does the highlight.js change affect Stack Overflow specifically?

This has already been asked on MSE1 but I think it belongs here, given how important this is for SO: What will the update cycle be? I’m asking because the current status of highlight.js language ...
Konrad Rudolph's user avatar
20 votes
Accepted

The revision history does not show the latest content correctly

A hotfix is now in place for this bug on both the /posts/{id}/revisions and /review/suggested-edits/{id} pages. Revisions will now be highlighted correctly in code blocks: This is a problem with ...
Kyle Pollard's user avatar
  • 2,204
19 votes
Accepted

What is the default language for the syntax highlighter?

Note: Since Stack Overflow's migration to Highlight.JS, the default is based on Highlight's automatic language discovery and best-effort highlighting. This answer is no longer applicable, but left ...
rene's user avatar
  • 41.5k
18 votes
Accepted

Do I remove syntax highlighting for sample input/output?

For data, input text, output text, and errors, use code formatting with no syntax highlighting. Syntax highlighting is only intended for use on the specific code language which it's highlighting. If ...
Makyen's user avatar
  • 31.9k
18 votes

SO renderer breaks Makefile syntax

There's a workaround, as per mbomb007's answer to the Meta Stack Exchange feature request. Writing this: <pre><code>Hello! This is a tab:&#9;:bat a si sihT</code></pre> ...
wizzwizz4's user avatar
  • 6,150
17 votes
Accepted

Syntax Errors in Code Renderer?

The syntax highlighter didn't pick up that you wanted Java highlighting. Instead, it seems to be interpreted as HTML (probably because it begins with a <). HTML attributes are set to be colored red,...
Anonymous's user avatar
  • 11.8k
17 votes
Accepted

Trailing backslash in strings breaks code formatting

The PowerShell tag is using lang-bsh as its prettifier. There is an open issue over on GitHub with an initial commit for a PowerShell prettifier. I linked to that item in an answer I wrote over on ...
rene's user avatar
  • 41.5k
15 votes

Revert new syntax highlighting

In order to be constructive, I'll try to provide a couple of (subjective) propositions: The color of types, properties and methods (#0096e2) is now very close indeed to the color of unvisited ...
Frédéric Hamidi's user avatar
15 votes
Accepted

Code block containing asterisks displaying in italics

This is the syntax highlighter trying to guess at a language for the regex. highlight.js has 3 language definitions that use an emphasis class, rendered as italic text. Since there is very little text ...
Martijn Pieters's user avatar
  • 1.1m
15 votes

Syntax highlighter gives up mid-word

I can repro here on Safari 14.0.2 and in STP 14.1 (BigSur). The colors stop where the overflown area starts, this is definitively a Safari bug, you should report it to them. Unfortunately I wasn't ...
Kaiido's user avatar
  • 124k
14 votes

MATLAB syntax highlighting?

MATLAB syntax highlighting is now live! Add syntax highlighting for the MATLAB language This is the "lite" version of @Amro's prettify script which does not include complete keyword highlighting (...
beaker's user avatar
  • 16.3k
14 votes

Need automatic syntax highlighting for Pascal

OK, I've enabled this. It should be effective immediately.
BoltClock's user avatar
  • 702k
14 votes
Accepted

GCC tag affects C++ syntax highlighting

I don't think that is a bug. From What is syntax highlighting and how does it work? If there's more than one tag that has syntax highlighting, it uses a default and lets Prettify infer what's the ...
rene's user avatar
  • 41.5k
14 votes

Please update the Google Prettify syntax-highlighting library

Whatever update or replacement is chosen, please make sure it deals well with dark corners of the supported languages, because we do get questions about those! Examples that the existing highlighter ...
14 votes
Accepted

Syntax highlighting for JavaScript does not support template literals on Stack Overflow, but does on Meta

Stack Overflow and Meta Stack Overflow are currently running different syntax highlighters: MSO (and MSE) are running highlight.js as of 10th September SO (and the rest of the network) are running ...
Nick is tired's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible