2

Why does <!-- language-all: lang-bash --> not highlight a list of commands and their output (like it used to) but adding the [bash] tag (instead) to a question does?

Example question: FQDN selection in "pg_hba.conf" does not work : DETAIL: Client IP address resolved forward lookup does not match

Here's a screenshot of what I see with <!-- language-all: lang-bash -->:

enter image description here

And here is a screenshot of what I see without <!-- language-all: lang-bash --> but with the [bash] tag added to the tags under my question:

enter image description here

18
  • Works for me here on MSE. On what site do you experience that problem and do you have a link to an example post?
    – rene
    Jul 8 at 12:14
  • @rene dba.stackexchange.com/q/314198
    – SebMa
    Jul 8 at 12:15
  • The instructions say language-all has to be at the top of the post. Jul 8 at 12:22
  • 1
    Still works for me: i.stack.imgur.com/JVcpH.png here and I see the same markup on dba.se
    – rene
    Jul 8 at 12:27
  • @RobertLongson I've just <!-- language-all: lang-bash --> to the top of my post but it still does not work.
    – SebMa
    Jul 8 at 12:50
  • It also works for me, but is subtle against the background color of DBA.SE. Could you provide more details, such as browser used/screenshot?
    – Erik A
    Jul 8 at 13:37
  • @ErikA I use Firefox 91.11esr. but I don't have access to i.stack.imgur.com from the office, do you know of another platform I can use to share a screenshot ?
    – SebMa
    Jul 8 at 14:45
  • Hmm... Firefox ESR support is an item. There are many sites that allow you to publicly share files (Dropbox/OneDrive/Google Drive/etc.) but I do not know of a good one for pictures that doesn't require an account.
    – Erik A
    Jul 8 at 14:54
  • @ErikA, OP: You can use ImgBB to upload your pictures and share a link to them. You don't need an account but you can create one if you'd like to save your uploaded pictures. Here's an example: ibb.co/Xsrkb4j
    – Justin
    Jul 8 at 15:17
  • You can include the links to your screenshots in your question and we'll help you edit them into inline images.
    – Justin
    Jul 8 at 15:23
  • @ErikA Screenshot
    – SebMa
    Jul 8 at 15:25
  • That has syntax highlighting, notice the green quoted star and slightly grey comment
    – Erik A
    Jul 8 at 15:28
  • @ErikA Yes, but the highlighting is really different if I use the bash tag : screenshot with bash tag instead
    – SebMa
    Jul 8 at 15:38
  • 6
    It is using default/guessed highlighting when you apply the bash tag, because the bash tag does not have a language set for it. In this case, your code is getting highlighted as SQL when you use the tag instead.
    – animuson StaffMod
    Jul 8 at 15:44
  • @animuson Thank you four answer, you got it right. If I remove the bash and type <!-- language-all: lang-sql --> at the top of my post, it does the same highlighting.
    – SebMa
    Jul 8 at 15:49

1 Answer 1

1

It is using default/guessed highlighting when you apply the bash tag, because the bash tag does not have a language set for it. In this case, your code is getting highlighted as SQL when you use the tag instead. - @animuson

Just a quick heads up, NEVER use that to highlight syntax, it is long and annoying :P. I recommend:

```lang-bash
Code
```[]

(Ignore the brackets, they are for formatting purposes)

So basically right after your triple back apostrophe, you put lang-[lang]. Make sure it is one word though. Short abbreviations of the language name is allowed, but do check if it works in the first place as some don't work, but always better to not use abbreviations I guess. E.g.

lang-py or lang-python

Both of the above provide the same syntax highlighting.

Check more on What is syntax highlighting and how does it work?

You can also put a version number after the langague name if you want (although the syntax will choose the latest one anyways and I have observed it makes no changes to syntax for some reason).

3
  • I prefer to use <!-- language-all: lang-bash --> because if you have 10 code snippets, you will have to type ``` lang-bash ``` 10 times.
    – SebMa
    Jul 9 at 8:14
  • That's true, but the syntax is messed up for lang all @SebMa
    – DialFrost
    Jul 9 at 8:18
  • Re "Short abbreviations of the language name is allowed": The supported aliases are documented in What is syntax highlighting and how does it work? near "All the language identifiers". Jul 9 at 9:34

You must log in to answer this question.

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