2

In this post I tried to add language hints for syntax formatting to code blocks quoted from the question. However, it seems they won't be honoured if I write them as a comment in my own part of the post, and if I include the hint in the qutotation as well then I have some ugly empty space before the code block. There should be a way to write these things properly.

1 Answer 1

8

Wrapping a codeblock (and only a codeblock) in a blockquote seems, at most, a rare edge case; to be honest I personally find it quite useless. There is however a way to achieve what you want.

<!-- language: ... --> hints only apply to the immediately following code block, which is the reason it doesn't work when the thing immediately following the language hint is a blockquote. There's however a second kind of language hint: The global override <!-- language-all: ... -->. This will apply the language to all subsequent code blocks (unless they have their own language hint, and until superseded by a new global override).

Thus adding <!-- language-all: lang-none --> to the top of your post (and removing both <!-- language: lang-none -->) will do exactly what you expect.

2
  • Does it mean that if on Drupal Answers I want to quote both the JS source and PHP source when facing a problem with AJAX, I'm by design unable to do it properly?
    – Mołot
    Sep 23, 2013 at 7:54
  • @Mołot You'd need to give one or both of those a syntax highlighter hint, which is exactly why those hints exist - using them is doing it properly. Sep 23, 2013 at 7:59

You must log in to answer this question.

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