I noticed that syntax highlighting is not enable yet on our site.

I am a believer that our site is not meant to answer blunt programming questions even if they have financial implications. However, we would gladly accept specific implementation questions where they are not basic, well explained and well documented. Doing this is sometimes not easy and can yield to large chunks of code. When this is the case, syntax highlight comes in handy and gives readers a better look-and-feel.

Usually this feature works in conjunction with tags (the question tag determines how code will be highlighted), but we have previously decided with mods that language-tags were not accepted here and were to be made synonyms of the programming tag, which I still think is a good approach. There is nevertheless a possibility to manually specific in posts which language is being used by adding a line of the type:

<!-- language: lang-or-tag-here -->

Therefore, I would like to suggest that StackExchange enable this feature for us.

What do you think?

  • 2
    $\begingroup$ Has this been enabled meanwhile? $\endgroup$ Commented Dec 17, 2016 at 23:51
  • $\begingroup$ @LocalVolatility not that I know of... $\endgroup$
    – SRKX
    Commented Dec 18, 2016 at 1:57
  • $\begingroup$ Thanks. I was asking because I couldn't get it to work here: quant.stackexchange.com/questions/22446/… $\endgroup$ Commented Dec 18, 2016 at 2:03
  • 2
    $\begingroup$ Poppin' by just to acknowledge this is in the CM team's backlog, and we'll update y'all once someone gets assigned to have a look at it @Bob. $\endgroup$
    – JNat StaffMod
    Commented Jan 12, 2021 at 10:43
  • $\begingroup$ Just to make sure, support for both the HTML language tag and the usual backtick markdown syntax would be useful and consistent with other sites. $\endgroup$ Commented Feb 12, 2021 at 7:32
  • $\begingroup$ Hi @JNat, do you have an update on this? Can it be done in the coming months? $\endgroup$
    – Bob Jansen Mod
    Commented Mar 5, 2021 at 7:32
  • 1
    $\begingroup$ Hi @SRKX, thanks for bringing this up! The team has been taking a look at this post for some time now, an update would be sent in soon. I would update this meta post with an answer once that happens. $\endgroup$ Commented Mar 5, 2021 at 15:22

3 Answers 3


Syntax highlighting is now turned on for Quantitative Finance (for both the main and meta sites).

  • $\begingroup$ How should a poster enable it? I put in some Python and tagged with python but nothing happens. Or will it only render after posting? $\endgroup$
    – Bob Jansen Mod
    Commented Mar 11, 2021 at 12:14
  • 1
    $\begingroup$ it should render in previews and after posting. can you drop me a link to the post? $\endgroup$ Commented Mar 11, 2021 at 12:18
  • $\begingroup$ Please check: quant.stackexchange.com/q/61655/848 $\endgroup$
    – Bob Jansen Mod
    Commented Mar 11, 2021 at 12:20
  • 1
    $\begingroup$ @BobJansen see the update that I made to the post there $\endgroup$ Commented Mar 11, 2021 at 12:26
  • $\begingroup$ I see thanks, so it does work but you have to put a code fence always. That I didn't expect to be honest. This is different from SO right? $\endgroup$
    – Bob Jansen Mod
    Commented Mar 11, 2021 at 12:31
  • 1
    $\begingroup$ Should be working now with the original way that you did it as well (I tweaked a setting), no need for code fence $\endgroup$ Commented Mar 11, 2021 at 12:40
  • $\begingroup$ Very nice, thanks for your help! $\endgroup$
    – Bob Jansen Mod
    Commented Mar 11, 2021 at 12:41

I see no good reason to not do this and the benefits are clear. So I fully agree, let's do this.


With regards to this, I quote from Meta Stack Exchange what the rules are supposed to be:

If a topic isn't primarily focused on programming but could substantially benefit from a particular flavor of syntax highlighting, post a request on the site's per-site meta and link to some (10 or so) posts where highlighting would be helpful. SE staff will then evaluate the request and let you know the result.

I think the a topic isn't primarily focused on programming but could substantially benefit from ... syntax highlighting bit fits Quant StackExchange perfectly. By the way, without programming skills no one goes far in interviews. Even Chemistry StackExchange has got syntax highlighting on!

So according to the Meta Stack Exchange post I have linked, we need to find at least 10 posts that would showcase how syntax highlighting is badly needed here.

EDIT: a list of some of the posts on quant.stackexchange that would benefit from code syntax highlighting:

  1. C++ code Thomas algorithm for solving a pentadiagonal Ax=b
  2. Problem with R code, with option pricing
  3. What is wrong in my non-linear estimation sample code?
  4. Tools/R-code to create gain/loss-asymmetry plots
  5. Trying to code Haug's 4.19.7 Double-Barrier Binary Asymmetrical
  6. EWMA VaR, code from Quant Risk
  7. Consistent offset/lag in time-series prediction using Neural Network (all code provided)
  8. Pricing a double barrier option using Monte Carlo (C++ & Python code included)
  9. Why does it take so many lines of code to price even the simplest of options with QuantLib
  10. Black Scholes diffusion well coded in Python
  11. Is there a python code for estimating the parameters of geometric brownian motion?
  12. heat equation : why my code does not generate enough decay in time?
  • 2
    $\begingroup$ The tag I added should put the process in motion (after the holidays) $\endgroup$
    – Bob Jansen Mod
    Commented Dec 30, 2020 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .