At the moment, we have these choices when providing error messages / logs:
- Use code-blocks
Use code-blocks
This preserves the formatting of the error message, though it uses spurious highlighting and disables line-wrapping (both the latter are seldom appropriate)
Use code-blocks with
<!-- language: none -->
Same as #1, but at least no inappropriate highlighting.
Use
<pre>...</pre>
Same as #2, but html works and thus must be escaped.
Use quote-marks
Markdown and HTML work and must be escaped, no fixed-width font and whitespace-collapsing, but at least line-wrapping works
Insert as normal text
None of the advantages of either previous option and all the drawbacks, though still popular with new users who do not know better or cannot be bothered.
This preserves the formatting of the error message, though it uses spurious highlighting and disables line-wrapping (both the latter are seldom appropriate)
2. Use code-blocks with <!-- language: none -->
Same as #1, but at least no inappropriate highlighting.
3. Use <pre>...</pre>
Same as #2, but html works and thus must be escaped. 4. Use quote-marks
Markdown and HTML work and must be escaped, no fixed-width font and whitespace-collapsing, but at least line-wrapping works 5. Insert as normal text
None of the advantages of either previous option and all the drawbacks, though still popular with new users who do not know better or cannot be bothered.
None of those is really good for logs/errors which easily get just too wide.
What I propose is introducing an alternative, which is especially appropriate for logs and error-messages:
Add something like <!-- language: log -->
which makes code-blocks use no highlighting and word-wrap their lines to avoid horizontal scrolling.
This SO question shows which style would have to be applied to code-blocks marked as log: How do I wrap text in a pre tag?