1

Often people just include screenshots to show their errors but today I tried to edit one of those posts, and the error message contained List<T>. For the sake of simplicity let's say

Error: Should be List<T>

is the error message. When I try to write that using a block quote I get this:

Error: Should be List

So it filters out the tag. It is possible to show the tag by adding a space in the tag, but that doesn't look as nice:

Error: Should be List< T>

Is there any escape character I can use for adding markup tags to a block quote?

Edit1: Backticks formatting is ugly:

Error: Should be List<T>

Edit2: Backslash doesn't work: (Error: Should be List\<T\>)

Error: Should be List\

Edit3: Using code blocks for error message doesn't look right in my opinion. For example this random error I took from a question:

E/SysUtils: ApplicationContext is null in ApplicationStatus E/chromium: [ERROR:browser_gpu_channel_host_factory.cc(258)] Failed to init browser shader disk cache. E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

vs

E/SysUtils: ApplicationContext is null in ApplicationStatus E/chromium: [ERROR:browser_gpu_channel_host_factory.cc(258)] Failed to init browser shader disk cache. E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

(Looks worse on stack overflow though for long exceptions with stacktrace etc.)

9
  • 2
    Same way you can anywhere else, wrap it in backticks <T>. Error messages should generally be code blocks, not quotes.
    – jonrsharpe
    Commented Jan 28, 2016 at 10:49
  • @jonrsharpe Backslash doesn't work in block quote. And I don't want to use backticks for showing an error message with markup tags, backticks are for code. Commented Jan 28, 2016 at 10:51
  • Jon surely meant to backtick just the code part. I see you consider it 'ugly' – unfortunately, it's the correct way to mark it up. How it gets rendered may differ from browser to browser, and also may get adjusted in the future (if SO's designers agree it looks bad).
    – Jongware
    Commented Jan 28, 2016 at 10:55
  • 2
    ...error messages are code-format too
    – jonrsharpe
    Commented Jan 28, 2016 at 10:55
  • 1
    They are! I interpreted this as a quote listing a piece of code; but if this is the literal output from a compiler, it's "terminal" output and should be in <code>.
    – Jongware
    Commented Jan 28, 2016 at 10:56
  • Hmm I always found long exception messages with stack trace (often posted) way more readable in a block quote. Most people use block quotes too for exceptions (as far as I see at least). Commented Jan 28, 2016 at 10:59
  • 1
    If you cram it onto one line or make it inline as opposed to block code it looks crap, but then just don't to that!
    – jonrsharpe
    Commented Jan 28, 2016 at 11:03
  • @jonrsharpe ok thanks, looks like I had it wrong then. There should really be more guidelines for stuff like that, I see loads of people doing it the way I was doing it :) Commented Jan 28, 2016 at 11:51
  • &lt; and using code markup to markup code isn't ugly imho.
    – user1228
    Commented Jan 28, 2016 at 17:38

1 Answer 1

4

It is possible. You can either use code formatting or use HTML escape characters. You technically only need to escape the < with &gt;, but some online character-escaping services will also escape > with &lt; (which is still interpreted correctly if non-code formatted text). So the following markup:

> Error: Should be List&lt;T>

Produces this output:

Error: Should be List<T>


Like some of the comments suggest, many users prefer using code-formatted text without syntax highlight to show error messages. That's achieved with the normal 4 space indent and applying the a special HTML comment <!-- language: lang-none -->above the error.

2
  • 1
    You don't have to html escape >. Only less thans. Check me edit for proofes.
    – user1228
    Commented Jan 28, 2016 at 17:38
  • @Will good catch.
    – ryanyuyu
    Commented Jan 28, 2016 at 17:43

You must log in to answer this question.

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