Questions tagged [syntax-highlighting]
For questions about the syntax highlighting performed inside code blocks on Stack Exchange sites.
358 questions
-4
votes
1
answer
209
views
How to highlight Windows cmd code block?
How do I a highlight a Windows cmd code block?
I've tried language tags in a code block on Stack Overflow: cmd, batch, batch-file, bat. Nothing works.
I'm using triple backtick syntax:
```cmd
echo %...
18
votes
1
answer
141
views
Syntax highlighting has poor contrast in dark mode
Code - at least for C#, I haven't tried other tags yet - is barley readable due to poor contrast in dark mode on the redisigned pages:
I'm using Firefox 148.0 on Windows 11
15
votes
0
answers
436
views
Fix wrong language in code blocks by changing from guess to spec?
Today, I found this question and most of its answers to have wrongly auto-detected language attributes for most of the code blocks:[1]
How to overwrite text in <p> tag using JavaScript - Stack ...
6
votes
1
answer
123
views
Preview syntax highlighting doesn't match display when submitted
We can create syntax highlighting on stackoverflow with the following format:
```{language}
code here
```
If the language is Python, you'll get syntax highlighting in preview, but not after you ...
4
votes
0
answers
178
views
Can we have syntax highlighting for AutoHotkey(AHK)? [duplicate]
I've scourged this site for similar questions, but the closest one was this:
Should we have syntax highlighting for AutoHotkey questions?
But it does not really tackle the question well in that it ...
12
votes
0
answers
164
views
Syntax highlighting is broken (renders as `lang-none`) despite a correct `lang-python` specifier [duplicate]
I've slightly edited this question. When I checked the final result, I noticed the Python code block was not properly highlighted. (I can't remember if it was before my edit.)
It's correctly (I think)...
4
votes
1
answer
211
views
Typescript language syntax highlighting broken when using "ts" or "lang-ts" code fence hint
Lately I've noticed the syntax highlighting for typescript questions is not applying when the code fence hint
```ts
or
```lang-ts
is used.
Example question - How to have TypeScript show computed/...
2
votes
0
answers
65
views
What is the correct way to enable syntax highlighting for the Zig language? [duplicate]
Currently code blocks in questions tagged with zig (for Zig) do not get any syntax highlighting by default.
Adding lang-zig to the opening triple backticks of the code block seems to enable some ...
3
votes
2
answers
260
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 ...
3
votes
2
answers
397
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-...
3
votes
0
answers
124
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
0
answers
427
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 ...
12
votes
1
answer
334
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:
...
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
```
4
votes
1
answer
200
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
134
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:
...
10
votes
0
answers
139
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
783
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 ...
4
votes
0
answers
188
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 ...
2
votes
0
answers
103
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
54
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 ...
6
votes
0
answers
193
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
94
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
198
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 ...
16
votes
0
answers
550
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, ...
21
votes
0
answers
486
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
121
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
390
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 ...
1
vote
1
answer
145
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 ...
8
votes
0
answers
69
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 ...
7
votes
0
answers
119
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^...
5
votes
1
answer
477
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....
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 ...
2
votes
1
answer
270
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 ...
2
votes
0
answers
125
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: ...
10
votes
1
answer
685
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, ...
6
votes
1
answer
1k
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 ...
6
votes
0
answers
468
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 ...
8
votes
1
answer
280
views
Syntax highlighting for numbers
I often post benchmarks and then the results look partly colored:
Sometimes someone edits my post to change the syntax highlighting from default to text, and then it looks like this:
I prefer the ...
6
votes
0
answers
207
views
Syntax highlighting Java code in response to a Kotlin question
I provided an answer to a question tagged kotlin and javafx. The code blocks in my answer were predominantly in Java.
Without any language tags on the code blocks, the syntax highlighting for the Java ...
9
votes
0
answers
512
views
Request to set the TOML tag to default syntax highlighting to lang-ini
As per the guidance in What is syntax highlighting and how does it work?
If the tag doesn't have a highlighting language specified when it should, create a feature-request on your site's per-site ...
8
votes
1
answer
368
views
Why does TOML code block formatting look so bad?
I have a Stack Overflow answer here that includes a TOML code block.
I have tagged the code fence:
```toml
But the resulting highlighting looks very poor and does not even highlight the comments ...
3
votes
0
answers
54
views
Partial syntax highlighting in a question [duplicate]
On questions where the code overflows, the syntax highlighting stops wherever the end of the content visible without scrolling is.
Scrolling down a bit fixes the issue. This problem occurs in Safari ...
3
votes
0
answers
92
views
Is there a comprehensive list of languages the code highlighter supports? [duplicate]
The triple backtick is my go to, to format snippets of code.
```
I regularly use them like:
```json for JSON
```py for Python
... and many more
Does a list of the linters Stack Overflow supports ...
5
votes
0
answers
91
views
Set lang-js as the default syntax highlighting for [react-native]
React Native code is basically React code, so I'm extending an old request that was made for React (Add the JavaScript language hint to the `reactjs` and `react-jsx` tags) to React Native.
Can we have ...
8
votes
1
answer
915
views
How to manually specify language of a fenced code block in Teams? [closed]
I am just getting started with Stack Overflow for Teams and the editor seems to be different. I type 3 backticks and a code block is automatically created, but the backticks disappear and I can't ...
2
votes
1
answer
96
views
Automatic syntax highlighting for [fortran] [duplicate]
I had assumed from Syntax highlighting for Fortran? on MSO and Please deploy Fortran syntax highlighting on MSE that Fortran syntax highlighting was not available on Stack Overfow.
But this question ...
0
votes
1
answer
66
views
The [libgdx] tag should syntax highlight for Java
libgdx is known primarily as a Java game framework. Although Scala and Kotlin work with it when it's not being used with GWT, the majority of incoming questions have Java code in them. All of libGDX's ...
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 ...