What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

I was trying to move the text in between the tables out of the code block in this question, but the preview refused.

I have a table that has ID and ParentId, I would like display each ID with its first parent, 
<pre>
  ID     | ParentId
---------|-----------------
     1   |   Null
     2   |   1
     3   |   1
     4   |   2 <-- its first parent its ID=1
     5   |   Null
     6   |   5
     7   |   6
     8   |   7
</pre>

So the query would display something like this.

<pre> ID   | first_ParentID
-------|-----------------
   1   |  Null
   2   |   1
   3   |   1
   4   |   1  
   5   |  Null
   6   |   5
   7   |   5
   8   |   5 
 </pre>
Thanks in advance to anyone willing to help, I'm not very good with queries.

Yet, it still appears as:

share|improve this question
    
Looks like the < was messing it up. –  Kermit Apr 12 '13 at 19:52
    
Get rid of the <pre> tags –  ypercube Apr 12 '13 at 19:53
    
Why are you using <pre>? –  Aaron Bertrand Apr 12 '13 at 19:53
    
@AaronBertrand OP was using it. I use it regularly as well. Annoying highlighting colors for table data. –  Kermit Apr 12 '13 at 19:54
    
Use <!-- language: lang-none --> if the colors inherent from the default language bug you (this is driven by the tags). Don't mix the HTML thingy with HTML, it doesn't mix well. –  Aaron Bertrand Apr 12 '13 at 19:55
    
@AaronBertrand That's more complicated then using a <pre> pair. I don't think the formatter should explode because there's an < –  Kermit Apr 12 '13 at 19:57

1 Answer 1

Here is an example of defining a code block and not having it overrun with colors you don't want.

  ID     | ParentId
---------|-----------------
     1   |   Null
     2   |   1
     3   |   1
     4   |   2 <-- its first parent its ID=1
     5   |   Null
     6   |   5
     7   |   6
     8   |   7

This is done by prefixing the code block with:

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

The full list of languages supported here are available in this meta question:

Syntax highlighting language hints

Yes, that is more complicated than a pair of <pre> tags. I'm just trying to help you with a workaround. They may take this and fix it, but they may not (as who knows what it will break if they make their code editor change its behavior / order of parsing etc., and I don't believe the code is all theirs in the first place). So if they don't fix it, or if you wait a long time for them to fix it (since there is a trivial workaround), you can use this syntax in the meantime.

share|improve this answer
    
While this works, it doesn't explain why the formatter explodes because of an extra < between the tags (especially if <pre> is allowed). –  Kermit Apr 12 '13 at 19:58
    
OK. I don't know why because I don't have source code access. I expect that parsing is out of order. In the meantime, I do have the ability to provide you a workaround. If that is not what you're after, that's ok, I can delete my answer. But it may be what another reader is after. –  Aaron Bertrand Apr 12 '13 at 20:00
    
I think this is a valid workaround, but still seems like a bug. –  Kermit Apr 12 '13 at 20:01
    
I agree, that's possible. And I can't answer to that. You'll have to wait for a dev or someone with internal knowledge to know why this blows up using <pre> tags. Just be aware they may simply tell you to stop using <pre> tags. –  Aaron Bertrand Apr 12 '13 at 20:03
    
If they tell me to stop using <pre> tags I just hope they remove it from their white listed HTML tags. –  Kermit Apr 12 '13 at 20:14
    
The tag itself isn't necessarily the problem, it's what you're putting inside of it. While yes, technically, a <pre> tag should support embedded HTML tags, you can shoot yourself in the foot this way with any of the tags. What does <kbd><hi there</kbd> display for you? Should it be blacklisted too? –  Aaron Bertrand Apr 12 '13 at 20:28

You must log in to answer this question.

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