48

After seeing How to include code inside a quotation? and its associated answer, I saw that a code block inside a quote block formatting is broken on meta. If we use the example from the answer on meta we get:

This class prints what is the meaning of life.

class MeaningOfLife {

    private static final String MEANING_OF_LIFE = "I love Java";

    public static void main(String[] args) {
        System.out.println(MEANING_OF_LIFE);
    }

}

Yes, you read right.

But on main we get:

Enter image description here

As you can see on meta the code is rendered as multiple single lines of code, but on main it is rendered as one single code block.

The views and opinions expressed in the code block is that of the original author and do not reflect the views and opinions of this C++ programmer.

This is how the two blocks are rendered on my system (Windows 7 Pro Chrome Version 50.0.2661.87 m):

Enter image description here

20
  • 1
    As long as the java is referring to coffee this non-java non-C++ programmer is in full agreement. Speaking about which... brb
    – Adriaan
    Commented Apr 28, 2016 at 14:43
  • Sorry, I don't follow. I see a single <pre> element in your meta blockquote. The only thing that's different is the lack of syntax highlighting.
    – BoltClock Mod
    Commented Apr 28, 2016 at 14:44
  • 1
    @BoltClock The top and and bottom code blocks look the same to you? Commented Apr 28, 2016 at 14:46
  • @NathanOliver: They do. On Firefox, if that helps.
    – BoltClock Mod
    Commented Apr 28, 2016 at 14:46
  • 9
    I'm an idiot. I was just messing with user styles yesterday after that whole prettify hoopla. Yeah I remember the darker background now.
    – BoltClock Mod
    Commented Apr 28, 2016 at 14:47
  • 2
    @BoltClock Okay. I added a screen cap of how it looks on my screen just in case others have the same thing. Commented Apr 28, 2016 at 14:49
  • 1
    Reproduced on Chrome 49 as well.
    – ryanyuyu
    Commented Apr 28, 2016 at 14:56
  • 1
    I'm using Chrome on Mac and I saw the same thing.
    – Laurel
    Commented Apr 28, 2016 at 15:34
  • 1
    Java Eeew... C++ programmer EEEW! GROSS!
    – user1228
    Commented Apr 28, 2016 at 16:09
  • That is really weird. It looks like plain, fixed-width text highlighted with gray. Commented Apr 28, 2016 at 18:16
  • Reproduced with FF 45 on Linux.
    – pydsigner
    Commented Apr 28, 2016 at 18:17
  • 1
    I fixed a few oddities with the poster's Markdown (use of HTML, dropping indent back to 0 for "empty" lines inside the quote), but the problem persists. Bah! It's being rendered with the inline-code (i.e. backticks) formatting rather than code block formatting. Probably a renderer bug. Commented Apr 28, 2016 at 18:47
  • @LightnessRacesinOrbit If it makes you feel any better I used the exact same block of text on meta and main. main required not changes at all. It just worked. Commented Apr 28, 2016 at 18:48
  • 11
    A dev casually lobbed in a huge sweeping change to the syntax highlighting system this week without any consultation or testing so that's probably why Commented Apr 28, 2016 at 18:51
  • 1
    Reproduced on Firefox 46 for Windows.
    – TylerH
    Commented Apr 28, 2016 at 18:58

2 Answers 2

2

And the winner is... @NathanOliver.

What was happening is that in meta blockquotes have the same background color as code blocks usually have. Thus, a custom darker color is set for code blocks inside blockquotes via css. Code blocks are positioned as inline, hence the strange look.

Solution: code blocks inside blockquotes are now inline-block and that's the result:

enter image description here

15

The CSS contains several instances of \9 (escape code for TAB character) causing things to break.

A bug report has been made here: Bad CSS on quoted code on Meta

5
  • 1
    I just added max-height: 600px; display: block; to the element through the inspector and it did render to code block correctly Commented Apr 29, 2016 at 14:48
  • 1
    Editing the offending CSS rule to remove the \9 fixes it too ;) Commented Apr 29, 2016 at 14:50
  • For whatever reason chrome was not letting me do that so I just added the corrected code. It is my first time doing that so most likely I am missing something. Commented Apr 29, 2016 at 14:51
  • That's weird because there isn't any tab character in the original code, just spaces. And it doesn't seem to work in Firefox?
    – Tunaki
    Commented Apr 29, 2016 at 14:53
  • @NathanOliver Whoa! The spaces in your comment made it overflow the code highlight.
    – Jed Fox
    Commented Apr 29, 2016 at 17:54

You must log in to answer this question.

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