Skip to main content

Questions tagged [syntax-highlighting]

For questions about the syntax highlighting performed inside code blocks on Stack Exchange sites.

Filter by
Sorted by
Tagged with
3 votes
2 answers
122 views

Why does this code block have weird formatting?

COMMAND and OUTPUT is formatted as italics in this post. I know <pre><code> can be used to format text in code blocks, but that answer uses just a normal code fence ``` ```. Here's the ...
16 votes
0 answers
320 views

Syntax highlighting: Use "lang-bash" (or similar) as default language for tags [powershell] and [powershell-core] until PowerShell is fully supported

Note: There are related existing posts, but this one makes a concrete proposal that complements the feature-request post that asks for proper PowerShell syntax-highlighting support via highlight.js, ...
8 votes
1 answer
244 views

There is no syntax highlighting in Discussions

On main site Q&A, syntax highlighting works as soon as you add a relevant tag to the question like php, or a language hint before the code block: // This comment is grey. Other colors are below: ...
-5 votes
0 answers
58 views

JavaScript syntax highlighting bug when using apostrophes [duplicate]

JavaScript highlighting seems broken in the code from my answer in https://stackoverflow.com/a/78903883/460084: const getVal = (obj, path) => path .replace(/\[(\w|'|")*\]/g, s => `.${sb....
-6 votes
0 answers
256 views

Syntax coloring for C is all over the place [duplicate]

In the upcoming C standard C23, there will be support for digit separators. Something C++ already introduced 10 years ago as per C++14 I believe. So there's been ample time to fix the code coloring, ...
3 votes
2 answers
97 views

TSX syntax highlighting doesn't appear to be working

I have a question about my Stack Overflow post: How can I change a TextInput's selection and fire its onSelectionChange event in unit testing? I have some code blocks in my question and my self-...
5 votes
0 answers
178 views

Fix prettyprint for bash [closed]

UPDATE: issue tracked on prettyprinter github repo I posted a bash code a few days ago and noticed that there is an issue with the prettyprinter as I am using the bash specific built-in variable $# (...
3 votes
0 answers
122 views

Syntax highlighting for Java code seems inconsistent or glitched [duplicate]

When I view the code in Remove duplicate character from a string and keep only single occurrences using recursion , the first few lines look like so: Notably, the type name String is inconsistently ...
4 votes
1 answer
269 views

PHP Syntax highlighter is not working properly [closed]

Stack Overflow's syntax highlighter is not working properly if I add php syntax in-between HTML. I checked in other markdown editors and it is working fine. Not Working (PHP) <picture> <...
3 votes
0 answers
147 views

HCL language for code block

It is possible to ask for a new language to be available for code blocks? If yes, I feel that adding the hcl language identifier would be handy. There is a similar question somebody ask not too long ...
160 votes
1 answer
24k views

What is syntax highlighting and how does it work?

I noticed that sometimes my code gets highlighted in different colors when rendered. What is syntax highlighting? How does it work? What if my code isn't highlighted correctly? How do I report a bug ...
1 vote
0 answers
39 views

Syntax color coding for Data Analysis Expressions (DAX) [duplicate]

Could we add language support for DAX to get syntax color coding when using: ```dax // code ```
36 votes
3 answers
816 views

SO renderer breaks Makefile syntax

The following answer contains an GNU Makefile: https://stackoverflow.com/a/27190627/402322 I tried to use the Makefile on my system, but it does not work, because the syntax is broken. I edited the ...
11 votes
2 answers
2k views

PowerShell Syntax Highlighting

I mainly answer PHP questions where syntax highlighting has always worked for me with just indentation. I've just started using PowerShell and have asked a couple of questions and syntax highlighting ...
5 votes
1 answer
171 views

Add language hint to [c++98], [c++03], ..., [c++26] tags

Can you please add a syntax highlighting hint for the C++ programming versioned tags such as c++20. It is generally recommended to use both c++ and the version-specific tag, and c++ already has this ...
9 votes
1 answer
110 views

Remove language hint from [gcc] tag or make [c++] a stronger hint

Every now and then, I come across C++ questions for which syntax highlighting is broken. For example: What's {} in void({})? renders as follows: This is obviously broken and should look like: ...
9 votes
0 answers
117 views

Use Python syntax highlighting for [micropython]

Can we add Python syntax highlighting for questions tagged micropython? Some random examples of questions when this would be helpful: Update screen every hour Why isn't my ILI9488 touchscreen working?...
7 votes
0 answers
413 views

Proper syntax highlighting for PowerShell [duplicate]

Tagging a fenced code block with powershell: ```powershell Write-Output "Hello, $Env:USERNAME" ``` produces no syntax highlighting: Write-Output "Hello, $Env:USERNAME" This ...
32 votes
2 answers
1k views

The revision history does not show the latest content correctly

In this answer, I updated the name of the class from Testing to SpellCheck, but the revision history, while looking it on inline mode, shows it as TestingSpellCheck. It's shown correctly when using ...
5 votes
1 answer
782 views

HTML formatting inside highlighted code blocks is no longer supported - how can I fix my posts? (Obsolete)

This question isn't relevant anymore since the site once again supports HTML formatting inside code blocks. Stack Exchange implemented the plug-in workaround noted in the answer, to resolve an issue ...
5 votes
0 answers
315 views

Is having the ability to apply rich text formatting inside code blocks important?

For many years, it's been possible to apply rich text formatting to code blocks inside posts by formatting the code block using the HTML tags <pre><code> and using more HTML tags inside ...
2 votes
0 answers
109 views

TypeScript syntax highlighting broken in this question [duplicate]

The problematic code (with lang-typescript code fence): type ParseFunc<OutT, InT> = (val: InT) => OutT; declare const parseString: ParseFunc<string, unknown>; declare const ...
4 votes
0 answers
112 views

Next.js and Next.js 13 tags should select TypeScript highlighting

Related: 1, 2, 3, probably many others, some out of date (Prettify is abandonware). Is there an alias system for inferring the language which is moderator-editable? An example here of where this is a ...
10 votes
2 answers
603 views

We should set syntax highlighting to Python by default for the `tensorflow`, `tensorboard`, and `keras` tags

The vast majority of code shown under the tensorflow, tensorboard, and keras tags is Python; the most commonly-used API for these libraries. It would be helpful if we could add automatic Python syntax ...
2 votes
0 answers
99 views

Syntax highlighting auto-detection is broken for the [tensorflow] and [keras] tags [duplicate]

Previously code blocks on questions tagged with a single programming language were automatically highlighted using that programming language, unless an explicit language was specified (e.g. via code ...
3 votes
0 answers
130 views

Could you please add the `pine` language code to three tags? [duplicate]

I would like to implement highlighting for Pine Script™ code, which is typically used in the following tags: pine-script pine-script-v4 pine-script-v5 Could you please associate the pine language ...
2 votes
0 answers
52 views

Add lang-cmake as syntax highlighting for the cmake tag [duplicate]

I guess that lang-cmake became available on Stack Overflow only recently. According to "What is syntax highlighting and how does it work?", moderators can assign syntax highlighting ...
13 votes
2 answers
447 views

Syntax highlight apparently broken in edit preview and suggested edits queue

I think currently syntax highlight is broken for edit preview and the suggested edit review queue. This is the case for the majority of posts I've seen, it seems the exception are code fences with a ...
26 votes
0 answers
171 views

Show code highlighting in suggested edits review queue [duplicate]

I've noticed that, when I'm reviewing suggested edits, the code highlighting isn't displayed unless it's explicitly written in the markdown like: <-- language: lang-js --> I guess that when ...
6 votes
0 answers
109 views

Add syntax highlighting for [gdscript] tag

Godot is becoming increasingly popular as a choice for a game engine, and it's also becoming popular in Stack Overflow as well: gdscript, godot It also has support with Highlight.js as well, and I ...
9 votes
0 answers
93 views

Add code highlighting for the Ballerina tag [duplicate]

Currently, the Ballerina tag does not have code highlighting associated with it. Can we add the Ballerina language syntax highlighting to the questions that are tagged with ballerina? This question ...
5 votes
1 answer
117 views

Code coloring not working correctly?

Just noticed an older answer of mine. As you can see here: the first code example has "some colors", the second one that is almost identical is all just white text. (using latest version of ...
19 votes
0 answers
299 views

Enable automatic and on-demand syntax highlighting for PowerShell (updated for highlight.js)

Note: After the discussion in the comments, a separate post was spun off from this one, linked to below. Note: This isn't a duplicate of earlier posts such as Enable a "lang-powershell" ...
3 votes
1 answer
81 views

VB code formatting is broken when comments are encountered?

I noticed that code formatting / colorization does not seem to be working right for questions which have VB code including comments. Here's an example from https://stackoverflow.com/a/56662842/3195477:...
2 votes
0 answers
285 views

Add syntax highlighting for Django templates (already supported by highlight.js)

Django questions are pretty common on Stack Overflow. Many of them use Django templates. Django is supported by highlight.js but isn't supported by Stack Exchange. This isn't necessary, but would be ...
10 votes
2 answers
246 views

Set JavaScript as the language hint for [unityscript]

It would be nice if the JavaScript syntax highlighting could be applied to the unityscript tag. I know I can enable it for individual posts, but the tag should default to the JavaScript syntax ...
2 votes
0 answers
36 views

Make [unityscript] code samples use lang-js syntax highlighting [duplicate]

Would it be possible to automatically have questions tagged with unityscript have their code samples be syntax highlighted with <!-- language: lang-js -->? I see questions tagged with c# get ...
9 votes
0 answers
98 views

Activate [deno] syntax highlighting without having to tag [javascript] or [typescript]

deno is a secure runtime for JavaScript and TypeScript, however unlike nodejs it doesn't yet have syntax highlighting. Would it be possible to activate syntax highlighting for Deno without having to ...
3 votes
1 answer
758 views

Syntax highlighting for Java properties?

Is there a syntax highlighting language hint (<!-- language: lang-??? -->) for Java properties? Or can a hint for another language/format be used for this purpose? Example snippet to which syntax ...
1 vote
1 answer
96 views

Syntax highlighting not working on one particular page, with warnings logged to console [duplicate]

EDIT: Ignore the part about the console warnings; these were not actually relevant to the highlighting issue. The issue was caused by the absence of the 'swift' tag and resolved by another user ...
86 votes
2 answers
2k views

What should we expect from syntax highlighting auto-detection?

In this question tagged html and jquery and a non language related user-input tag the following really simple block of HTML, <input id="foo" type="text"> <input id="...
8 votes
0 answers
62 views

Clarify "Syntax highlighting for code": specify where to put "language-all:" directive

On the page Markdown help, section Syntax highlighting for code needs to be clarified. Original text: To specify a syntax highlighting language to be used not only for the next, but for all following ...
5 votes
1 answer
297 views

Is C# syntax highlighting broken?

See an answer I wrote here. The code is all in white, even though the question is tagged c# I also tried with the ```csharp syntax, and it's still white text TimeZoneInfo tz = TimeZoneInfo....
14 votes
0 answers
643 views

Could Vue.js questions be adjusted to highlight correctly?

Currently, the vue.js tag does not automatically apply any syntax highlighting. I have reviewed these 2 posts: Meta SE - What is syntax highlighting and how does it work? Meta SO - What is syntax ...
7 votes
0 answers
93 views

There is italic in the code blocks (bug) [duplicate]

First time today I see some italic in a block code, e.g. here: from sympy import * from sympy.parsing.sympy_parser import * from sympy.abc import x,y,z,w,a,b,c,d eq = x*y + 1#parse_expr('((x^2+y^2+z^...
2 votes
0 answers
63 views

Syntax Formatting Bug with Method Parameter Attributes in C# [duplicate]

Syntax highlighting of attributes on method parameters in C# seems buggy. The code at the bottom of this question doesn't render the first attribute correctly. I've replicated the code and provided a ...
1 vote
1 answer
179 views

Add default syntax highlighting for [excel-formula] tag

We should add a default syntax highlighting language for excel-formula. Although highlight.js supports the Excel formula language, Stack Exchange does not (and I doubt this will change soon as this is ...
6 votes
1 answer
302 views

C# Syntax Highlighting broken? [closed]

In my post here, the C# highlighting is incorrect: Randomly, the DXGI namespace isn't highlighted (maybe because all uppercase) bool and get are not recognized as keywords. set is recognized as a ...
2 votes
0 answers
102 views

HTML syntax highlighting on JavaScript questions

It's common for questions tagged javascript to have answers containing HTML code snippets, but it seems like they often aren't being highlighted properly. For example, in Restart animation in CSS3: ...
8 votes
1 answer
398 views

Change Default Syntax Highlighting for [typescript] from lang-js to lang-typescript

The current syntax highlighting for typescript is lang-js. This is presumably due to the fact that lang-typescript was not available in the mod dropdown menu of syntax highlighting options, however, ...

1
2 3 4 5
8