I have come to believe that this should be a new question, but it has spawned from answers and comments I have written with regards to these two Meta Stack Overflow posts: Code in comments should be Multi-line comments on Stack Overflow.
What follows is my argument for a feature that is sneakily importantly needed: proper multilining in comments (at least for code) and so long as that code follows legibility constraints that are expanded versions of those suggested for representing code in comments in Code in comments. In that discussion, there seems to be too much focus on a single use-case of code in comments that is overemphasized at the cost of seeing the other kinds of code that are not well represented by the example poorly formatted when it is inevitably written into comments.
Currently there is no system for properly formatting code left in comments. I have to point out that if the consensus is that code in comments is ever useful, even if the goal is to dissuade people from posting long chunks of code into comments, wouldn't it be desirable to have proper line-breaks and other simple formatting options (optional syntax highlighting) for code snippets that are not too many lines long.
New python executables in MYENV/bin/python3.4 Also creating executable in MYENV/bin/python Installing setuptools, pip, wheel...done.
is much easier to read than `> New python executables in MYENV/bin/python3.4 > Also creating executable in MYENV/bin/python > Installing setuptools, pip, wheel...done.`
And I'd much have preferred to write that (here: What is the easiest way to remove all packages installed by pip?). And it would not have taken up much more space compared to other comments. So legibility suggests that better formatting for those shorter code snippets should be desirable if it is recognized that code snippets should be subject to any strictures of design.
Furthermore — that concern – I'd argue – should win over a theoretical concern raised in this cross-linked post which shifted a discussion about multi-line comments to the appropriateness of including code in comments in the particular case where you are writing modifications of example code from the post and this produces a synchronization attention-death. However, this use case does not cover all the kinds of instances where code formatting would be useful. Nor does it eliminate the number of people who have discussed the need for line breaks at least on critiques of answers and others who care enough to have extensively tried to test for this ability (notable for amusing persistence is @Kieran in a comment thread in this post).
In the words of @aximili:
From the perspective of this question's implied point of not wanting to encourage long comments filled with illegible long strings of code (such as >200 characters of consecutive code), even if you have multiple lines of code that skew the display of the comment section to a more vertical dimension, you could put an upper limit on numbers of lines allowed , and if the warning is instituted in the form as it is described here, it could additionally warn people if they exceed some threshold of character density or lack of density. Either cramming a lot of code onto the line (e.g., with multiple semi-colons separating code snippets) or too little code per line (just 100 line breaks in a code block) would be worrisome practices that should be discouraged with such a warning if not an outright error.
So in that sense, it seems like this warning about long code in comments is worthwhile, however, for the things that don't trigger the warning, there should be a better method for formatting them. Currently they are far too hard to read. Scaling Consolas down to 11 pxs (14 pixels leading) might make it a little hard to read if viewed at a distance, but 12 pxs (15 pixels leading) is still a bump down and would still have less leading if there is an analogous concern to font shrinking observable in comparing the main text to code in questions and answers.
But more generally the critiques that have been raised in various places (1, 2, and 3, by @Asad) do not seem to hold for all cases of giving code snippets. In some cases, the code may be given as an example of alternative output or other results that may occur.
Worse, in whitespace sensitive languages like Python, this kind of whitespace dissolution can actually transform code from valid to invalid. To not do this is in effect making it impossible to provide even short snippets of some conventionally, validly formatted text that would otherwise meet the criterion of being a readable comment.
Supplementary note on text formatting specifics and their relation to minimal max-lengths for code snippets in comments:
For reference the main text is Helvetica Neue Regular (15 pixels with 19 pixels leading) and code blocks are typeset in Consolas (13 pixels with 16 pixels leading), since in the comparative context in a comment, the main text is Helvetica Neue Regular (13 pixels with 16 pixels leading).
The minimal max for multiline code would need at least a total of 5 lines would make it no longer than the max of the current comments with single spaced 600 characters per code line, even at the same Consolas (13 pt with 16 pt leading) it uses for inline
code formatting in questions, answers or comments.
I can go on, but I don't know if there are arguments that exist that would satisfy someone that did not find the above to be at least somewhat convincing. Even if counterarguments can be made against any one of the individual points, it will be hard to find a single counterargument that fits with what was previously recorded as I have linked here. If there is another argument please respond, I'm interested to hear it.
Some of this was built off of this answer to one of the aforementioned links.
Edit: This also gives a potential solution to this problem: Convert code blocks to backtick syntax when converting answers to comments at least in the cases where the codeblock is not too large.