Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [syntax-highlighting]

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

7
votes
0answers
45 views

When does SE update their google-code-prettify builds?

Developers in the Elixir community have been trying to get Syntax Highlighting support for the Elixir Language on Stackoverflow and other Stackexchange websites since 2013: We have gone through all ...
1
vote
1answer
116 views

Which Stack Exchange sites have syntax highlighting enabled?

The code syntax highlighting feature is only enabled on certain sites. In order for code to be highlighted and for any of the hints listed in the above question to work, the Markdown extension has to ...
9
votes
0answers
93 views

Syntax highlighting for DataScience SE [duplicate]

The Data Science SE site requires syntax highlighting feature as the posts contain code from multiple languages/syntaxes including but not limited to Bash, Regex, Python, Julia, Java, R. We collected ...
1
vote
0answers
165 views

Syntax highlighting for shell sessions? [duplicate]

Edit: I've opened an issue for this in the code-prettify project on GitHub. The author of the question Why does bash login shell break here-doc command string argument? noted in the comments that: ...
1
vote
0answers
34 views

Syntax highlighting for form elements sometimes do not work [duplicate]

I posted a question that has this code <input type="text" v-model="myVar" @keyup.enter="doFilter" /> <button class="md-icon-button md-raised md-accent md-dense" @click="doFilter">Filter&...
0
votes
0answers
26 views

Syntax highlighting hints not working for in-line code [duplicate]

It appears that manual syntax highlighting hints aren't working properly for in-line code samples. If I specify the language for my question using <!-- language-all: lang-java -->, the language ...
46
votes
1answer
1k views

Support Kotlin in code highlighting

The relevant PR was merged into code-prettify: https://github.com/google/code-prettify/issues/491 As per instructions, I'm asking to deploy it to the network and assign to kotlin tag.
1
vote
0answers
48 views

JavaScript syntax highlighter does not highlight template literals correctly

The lang-js highlighter does not appear to recognize backticked strings properly: let s = `a a a 'a a a' "a a a" a a ${true}`; // not quite let t = `a a a 'a a a ${true}'`; // a little ...
2
votes
0answers
113 views

Escape backslash inside string for syntax highlighting

This question has a block of code containing a string like "\foo\". The syntax highlighting (reasonably enough) assumes the \" is an escaped double-quote and continues the highlighting for string for ...
2
votes
0answers
17 views

Inconsistent code highlighting on the iOS app

I've noticed a few posts with code blocks that aren't getting any syntax highlighting when they should. This Q&A for example has no highlighting: Whereas this Q&A does: The strange ...
3
votes
0answers
88 views

Add syntax highlighting for the Makefile language

I want to post a question with a significant chunk of Makefile code, but the preview given from my code isn't very exciting, and it highlights seemingly random words here and there. The seemingly-...
1
vote
0answers
43 views

Syntax highlighting for unimplemented languages by introducing aliases of lang-none

Today I "struggled" with misleading syntax highlighting of markdown code examples, the problem was that using lang-none changes the colouring so that a previously unaffected markdown example looked ...
12
votes
0answers
57 views

A Stack Exchange fork of Google Prettify

Please consider maintaining (y)our own fork of Prettify. I just tried to add new keywords for Swift¹ but they wanted me to sign a CLA with all kinds of personal information and the project does ...
10
votes
1answer
92 views

What reputation is needed to suggest language hints to be used for particular tags?

In What is syntax highlighting and how does it work? it says: If you're curious whether a tag has a language hint, any user is capable of checking by visiting that tag's wiki page. The language ...
1
vote
0answers
24 views

Is there a language/syntax highlighting setting for diff? [duplicate]

I'm trying to ask a programming question about an internal IDE project file that is changed when files are added and removed from the project (References to Removed Framework in project.pbxproj File). ...
9
votes
1answer
157 views

Create Verilog Syntax Highlighter

According to the question Enable Verilog syntax highlighting, it is clear how to enable the syntax for various languages. That is not what this question is about, nor is it a duplicate of that. ...
5
votes
1answer
62 views

Code blocks are not prettified on mobile site

On Chrome on Android, code blocks on the mobile site have no syntax highlighting, are not a monospaced font, and words are wrapped. Mobile site on mobile browser: Desktop site on mobile browser: ...
1
vote
0answers
51 views

How to change the default code colour theme on Stack Overflow?

I understand that Stack Exchange is using Google Prettify as its engine. I don't like the default them and I found some colour themes for it. I did try it myself first and when I import my .css file ...
14
votes
2answers
105 views

How to get syntax highlighting activated on another SE site?

It seems syntax highlighting is not enabled on every SE site, but later on turns out to be rather advantageous. As an example, Graphic Design may not have sounded like needing it, yet there is a ...
3
votes
0answers
55 views

Stack Overflow Syntax Highlighting Bug on Android Application [duplicate]

Update I am now seeing that the text is being coloured correctly on my PC system and the issue seems to be only with the Android application. Either the issue is an intermittent one or I was simply ...
5
votes
1answer
66 views

Can a user script modify or apply syntax highlighting in SE sites?

SE currently use Prettify for syntax highlighting. However, there are still some languages which have no support from default Prettify, or by the extensions that SE may be using. If I wanted to test ...
4
votes
0answers
28 views

Document required blank line before language hint in Markdown help

As per Python's “//” operator wrongly treated as a comment (part 3), there must be a blank line before a language hint — otherwise, the hint is silently ignored. Markdown Editing Help doesn'...
143
votes
1answer
3k views

Highlight.js: For Real, Please

Background: SE currently uses the Google code-prettify library for syntax highlighting. The possibility of switching has been suggested in the past: Why doesn't StackOverflow use Highlight.js ...
2
votes
0answers
41 views

Can we add the triple backticks feature for code formatting in markdown? [duplicate]

Disclaimer: My request is about using the same markdown format used in GitHub for code blocks and syntax highlighting. In most recent markdown formatters, other than the 4 space indentations, we can ...
4
votes
0answers
46 views

Why is syntax highlighting not working for my Perl script? [closed]

In this post I added a perl script. This script works and is correctly highlighted in all the editors that I tested in. Yet still highlighting doesn't seem to work as expected on SO. From this line ...
2
votes
0answers
38 views

Syntax-highlighting comments are very picky about the number of spaces inside them

It seems that the comments for setting the syntax-highlighting of a code block require a space after the language:. This works: <!-- language: lang-or-tag-here --> This doesn't work: <!-- ...
4
votes
1answer
47 views

Why isn't this language hint working?

In the following answer I've inserted this language hint <!-- language-all: lang-html --> However, it is not picking it up and therefore not formatting it with HTML syntax colours. https://...
1
vote
0answers
12 views

iOS app syntax highlighting issues [duplicate]

I have noticed that the iOS app isn't highlighting syntax correctly, even with the explicit comment: <!-- language: whatever --> For example, compare this question in Chrome for iOS (47.0.2526....
3
votes
1answer
48 views

Wrong XML Comments in Code-View

It seems there is a bug in the XML-Code-Viewer in StackOverflow: See the related post: doFilter HttpServletRequest return null In XML comments are made by <!-- Comment --> Apparently there ...
2
votes
0answers
107 views

Update Google Prettify to get highlight support for Logtalk and Prolog code

Recent versions of Google Prettify include highlight support for the Logtalk programming language, which can also be used for the Prolog programming language (Logtalk syntax subsumes Prolog syntax).
6
votes
0answers
62 views

Add the lang-mumps module from Prettify

As of late, I have been writing a number of answers on CodeGolf.SE, using MUMPS (or a close variant) as my language of choice. MUMPS tends to look remarkably like line noise, whether or not you're ...
19
votes
2answers
266 views

Syntax highlighting: <!-​- language: lang-none --> does not seem to work for block quote

After using <!-- language-all: lang-sql -->, this is formatted as SQL: SELECT * FROM foo LIMT 12345; Next, a block quote (to keep line breaks!), but language syntax is not desired. So I use &...
5
votes
1answer
195 views

Update code-prettify

There have been certain changes in code-prettify which it’d be nice to have used on Stack Overflow et al. The primary matter I care about is the Rust highlighter because the one currently used handles ...
1
vote
0answers
54 views

Syntax highlight for the Swift programming language [duplicate]

Recently Apple announced the Swift language to be open sourced later this year. I noticed that google prettifier, which is used in eg. stack overflow to post code snippets, is not yet been adapted ...
8
votes
1answer
76 views

Adding a language hint to a tag for syntax highlighting

I am a moderator over at Economics.SE, where some users have requested that syntax highlighting be implemented for questions that use the r, Matlab, or python programming languages. As I understand (...
1
vote
1answer
34 views

How can I associate specific tag with specific syntax highlighting

My understanding based on what I've read on meta is that syntax code highlighter applies specific syntax code highlighting if question is tagged with some corresponding tag. The thing is that it's ...
4
votes
1answer
79 views

Syntax coloring doesn't show on Cross Validated (stats) site [closed]

Syntax highlighting doesn't appear to work on Cross Validated. For instance, see the question PyMC for Categorical Latent Model which is set to use the Python language syntax via: <!-- language: ...
3
votes
1answer
62 views

How to turn off syntax highlighting in indented portion of block quote

I've edited this answer, adding text that I copied from a FAQ and then block quoted: > 3.1) How do I find the creation time of a file? > > You can't - it isn't stored anywhere. ...
9
votes
0answers
93 views

Replace lang-rust for prettify [closed]

Google doesn’t maintain code-prettify. Things like my patch for proper Rust support—https://github.com/google/code-prettify/pull/375—just get ignored. Could you guys take my lang-rust.js and use it ...
0
votes
0answers
24 views

Get keyword not highlighted (SO) [duplicate]

When I was browsing SO, I came upon a unexpected syntax highlighting quirk. In C# code, the "set" keyword, used in properties, was highlighted, but not "get". Could this be changed? Here's a sample ...
21
votes
0answers
288 views

YAML highlighting doesn't work on StackExchange sites but is supported by Google Prettify

When I comment a code-block with <!-- language: lang-yaml --> the page is generated with the right css-class lang-yaml but it has no effect. There is no syntax highlighting for YAML. Example: ...
-2
votes
1answer
110 views

Syntax Highlighter for Java [duplicate]

It seems the syntax highlighter is not able to handle Java. Any idea how to help fix this? A sample code is below, and link1 and links2 in stackoverflow. try (Statement stmt = con.createStatement())...
7
votes
1answer
101 views

Code syntaxhighlighting does not work in “About Me”

I placed some source-code in the "About Me" section and it does not seem to work properly. During the formatting <!-- language: java --> results syntax-highlighted code in the preview box but ...
1
vote
1answer
42 views

Why doesn't language:lang-none work?

I tried using <!-- language: lang-none --> to display the output of a program without any syntax highlighting at https://stackoverflow.com/questions/29081895/c-vector-seems-to-be-overwritten-on-...
11
votes
0answers
403 views

google-code-prettify seems dead

The code formating engine used by SO (google-code-prettify) seems dead (lasts two commits have been made on sep 2013 & mar 2014). As stated on this post, each code-formatting request have to be ...
-2
votes
1answer
85 views

Python's “//” operator wrongly treated as a comment (part 3) [closed]

The closing reason for Python's “//” operator wrongly treated as a comment (part 2) , "Python is a webby language", was refuted (by none other than Martijn Pieters, one of the top Python experts ...
6
votes
0answers
32 views

Update the syntax highlighting help with current meta links

The syntax highlighting help links to Changes to syntax highlighting, a locked thread focused on presenting a new feature and not of general interest today. It also links “one of the supported ...
6
votes
1answer
48 views

Syntax highlighting in SEDE editor fails past 5000 characters on a line

If you open this query and fork it (so it opens in the SEDE editor), and then scroll about two-thirds of the way to the right, you see that syntax highlighting vanishes. It appears to vanish past 5000 ...
9
votes
1answer
50 views

Default to lang-sql syntax highlighting for Meta.SE posts tagged with [data-explorer]

It would be nice if posts here on Meta.SE that are tagged with data-explorer would automatically have SQL syntax highlighting (a la <!-- language: lang-sql -->) applied, in the same way that ...
11
votes
1answer
190 views

Syntax highlighting in app differs from normal web view

I've just noticed viewing a Python answer (since modified: see revision 2) on Stack Overflow that the Android app shows new (incorrectly) highlighted as a keyword which differs from the normal render ...