6
\$\begingroup\$

The syntax highlighting (for Go) does not seem to be applied for this question: db access wrapper for Go project

I tried to apply it manually to my answer (https://codereview.stackexchange.com/a/169234/80949), using <!-- language-all: lang-go -->, but it looks worst than in the question!

I know that syntax highlighting for Go can look better on CR (see Generate thousands of JSON documents in Go): how can we fix this?


Edit this is probably related to the database tag (as Peilonrayz noticed): if you remove it, the syntax highlighting works fine.

A bug remains: why can't I force the go highlighting on a database question?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ I removed the database tag from the question in the edit screen, and it changed the code to what you expected. Aside: I personally don't know why that tag changes syntax highlighting... \$\endgroup\$
    – Peilonrayz Mod
    Commented Jul 14, 2017 at 10:56
  • \$\begingroup\$ From what I understand, the tag is an hint for the right syntax highlighting. In this case it seems to be an obstacle to language customization. \$\endgroup\$
    – oliverpool
    Commented Jul 14, 2017 at 11:33

1 Answer 1

5
\$\begingroup\$

The tag didn't have an associated syntax highlighter, so the highlighting you'd get with the tag alone would have been the default one.

<!-- language: lang-go -->

should actually be

<!-- language: lang-golang -->

That's the highlighter I've just associated with the tag, so all GO questions and answers should now have correct & proper syntax highlighting... Unless some erroneous <!-- language hint is in place.

Aside: I personally don't know why that tag changes syntax highlighting... – Peilonrayz

You don't get to see it, but tags' Info page have a syntax highlighting dropdown that determines how a given tag affects how code gets syntax-highlighted in a post. In the case of GO, that dropdown was set to "none".

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Oh look, there's a syntax highlighting dropdown! Seems like I haven't visited a tag info page since I became a moderator. Shame on me. \$\endgroup\$
    – Simon Forsberg Mod
    Commented Jul 14, 2017 at 13:35
  • \$\begingroup\$ When I said the 'aside', my main point was, 'I don't know why the database tag would have the syntax highlighting specified to anything but "none"'. That must have been unclear of me, sorry. \$\endgroup\$
    – Peilonrayz Mod
    Commented Jul 14, 2017 at 13:46
  • \$\begingroup\$ @Peilonrayz ha! correct - it was set to lang-sql, I've just set it to none. Thanks! ..side-effect of this being any database post without a sql tag just lost its syntax highlighting. \$\endgroup\$
    – Mathieu Guindon Mod
    Commented Jul 14, 2017 at 13:47
  • \$\begingroup\$ @Mat'sMug Kinda reminds me of how the Python tags work. There shouldn't be any like that IMO anyway, :) \$\endgroup\$
    – Peilonrayz Mod
    Commented Jul 14, 2017 at 13:52
  • \$\begingroup\$ @Mat'sMug You mean questions like a few of these? ? \$\endgroup\$
    – Simon Forsberg Mod
    Commented Jul 14, 2017 at 20:58
  • \$\begingroup\$ @SimonForsberg from a quick look at a couple of them, yes, indeed - and it's much better that way! (none of the 5-6 ones I opened had actual SQL in them) \$\endgroup\$
    – Mathieu Guindon Mod
    Commented Jul 14, 2017 at 21:04

You must log in to answer this question.

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