I have seen so many people confuse ``` with ''', resulting in a post that needs to be edited. Can the linter add a warning that ''' does not highlight code, or can it be added in the sidebar?
It occurs to me that using the tilde (~~~) instead of the backtic in the sidebar might be advantageous here. Although... That might be harder to read; the tildes kinda run together a bit. BTW: about 36 posts made this mistake in the past 2 days.
@MartijnPieters that might make it hard for a linter but to a human it's often evident when there is a docstring or code fencing. Part of the distinction is that code doesn't appear in docstrings
@MartijnPieters Presumably, any properly used python multiline string literals would be located inside a code block already, right? So we could only gave a warning if the ''' was outside a code block.
@divibisan: no, not if the OP didn't format their code properly. My point is that in such cases you can't automatically distinguish between mistaking ''' for a code-fence and the legitimate Python syntax.
@MartijnPieters True, but in that case there is still a problem with the code fencing, so a gentle warning about improperly formatted code block would still be appropriate
Seeing SO already uses tags for language highlighting already. exceptions like Python could be handled differently by either not showing the warning. Or adding a bit of text saying it may not be the case for python users
Unpopular opinion: If the question is older than a few minutes, downvote and move on. This mistake should be very noticeable to the OP after posting and easy enough to fix.
I wonder why OP didn't correct the error in the review step. (Probablybecause the source is put at the first and the OP thought they should review that!?)
This site is intended for bugs, features, and discussion of Stack Overflow and the software that powers it. You must have an account on Stack Overflow to participate.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
'''
or"""
as delimiters, and multiline strings are commonly placed at the top of a module, class or function as documentation. Don’t confuse that use for a misspelling of code fencing.'''
was outside a code block.'''
for a code-fence and the legitimate Python syntax.