Skip to main content
6 of 10
edited title
Deduplicator
  • 1.7k
  • 15
  • 24

Add format for logs/warnings/error messages which allows word-wrapping and preserves newlines

At the moment, we have these choices when providing error messages / logs:

  1. 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) 2. Use code-blocks with <!-- language: none -->

Same as #1, but at least no inappropriate highlighting.
Using <pre>...</pre> has the exact same effect. 3. Use quote-marks

None of the drawbacks of #1 or #2, but even though it is marked as non-plaintext, it collapses whitespace (including newlines) like plain text. 4. 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?

Deduplicator
  • 1.7k
  • 15
  • 24