22

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 <!-- language: lang-none -->:

Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMT 12345;
                                              --------^ here!

The above does not seem to work, currently.
It does not get through to code in the block quote.
However, <!-- language-all: lang-none --> works:

Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMT 12345;
                                              --------^ here!

But I really did not want to use <!-- language-all: lang-none -->. I want SQL format again:

SELECT * FROM foo LIMT 12345;

Now I have to use <!-- language-all: lang-sql --> again:

SELECT * FROM foo LIMT 12345;

Related:
What is syntax highlighting and how does it work?

2 Answers 2

19

The highlighting hint only works when it's placed immediately before the code block. When the code block is inside a list or blockquote, the hint also needs to be inside that list or blockquote. However, it looks like our system doesn't properly parse the hint if it's the very first thing in the blockquote.

So this will parse out the hint and incorrectly leave an empty paragraph instead of changing the syntax highlighting:

> <!-- language: lang-none -->

>     Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMT 12345;

But this (kind of a workaround) will correctly apply the highlighting hint inside the blockquote:

>  

> <!-- language: lang-none -->

>     Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMIT 12345;

Which renders as:

Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMIT 12345;

No syntax highlighting!

2
  • 3
    Excellent, insightful answer. The only reason I am not accepting it is that I am hoping for a fix instead of a workaround. Sep 9, 2015 at 23:59
  • Still no fix :( Though I am so pleased you found a work around!
    – JustCarty
    Jun 14, 2018 at 9:26
8

For completeness: You can use a <pre> block to work around the issue in this particular case.
Like:

<pre>
Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMT 12345;
                                              --------^ here!
</pre>

Displayed as:

Keep line breaks, but no syntax highlighting, please: SELECT * FROM foo LIMT 12345;
                                              --------^ here!

Without highlighted syntax like in:

SELECT * FROM foo LIMIT 12345;

But that only works for lang-none, since a <pre> block happens to do the same. Not for other syntax variants.

You must log in to answer this question.

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