Timeline for Posting properly formatted code is poorly explained and harder than it needs to be
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 1, 2022 at 17:45 | comment | added | zcoop98 |
To be fair, while the behavior of de-indenting indented code might feel inconsistent, it's incredibly useful when fixing such formatting mishaps, precisely because it de-indents. When fixing indents in a post or converting from indent to fence notation, being able to Ctrl-K away the indent instead of copy-pasting the code into an off-site editor is a godsend. Otherwise, I'm fully in support of replacing the indent behavior of the current editor. Worth noting that the new editor (despite its own horrors) does use fence notation.
|
|
Jun 1, 2022 at 15:24 | comment | added | codewario | I prefer code fences except for inline monospaced text. Having to prefix with 4 spaces is awkward and while I got used to writing code samples in-editor for a long time that way.... it's nice to be able to align the code text to the far left with everything else. Makes copy/paste quite a bit easier, too. | |
Jun 1, 2022 at 11:39 | comment | added | Peter Mortensen | Code fences are against the "down" in (the original) Markdown (minimal visible markup content—e.g., readability of the source), but the new syntax highlighter (and/or how it is implemented) leaves no choice but to use code fences (as the alternative would be even more complicated). Most posts, new or old, now need explicit syntax highlighting hints (in the parts that are not in main tag's programming language) in order for the new syntax highlighter to not mess it up. | |
Jun 1, 2022 at 6:14 | comment | added | user438383 | There is simply not adequate support in the editor to fix up messy posts which have been indented. I often have to copy and paste things into a local editor to sort them out, if I’m feeling generous. Code fences using backticks are vastly easier to clean up in my view. | |
Jun 1, 2022 at 5:34 | comment | added | Chayim Friedman | @RyanM While I also prefer code fences, I'm afraid people are just copying their code as-is, and it is identified as code block just because it is indented. And if we didn't have that, it would be even harder to read. | |
Jun 1, 2022 at 4:40 | comment | added | 0Valt | I think your observation is correct, @KarlKnechtel. I am an active suggested edits reviewer, and from what I've gathered so far, the quality of posts with ill-formatted code because of whitespace indentation varies wildly (we also need to keep in mind that the issue plagues answers just as much as questions). There are those that are beyond salvation, and no amount of changes would help them, but there indeed are those (and an insubstantial number, I might add) that get tricked by the caveats of properly indenting with whitespace. | |
Jun 1, 2022 at 4:38 | comment | added | Ryan M Mod | I strongly prefer code fences. Specifying the language for indented code blocks is awkward and non-standard. Indentation creating code blocks also creates the problem of people pasting code and not noticing that they failed to make the first and last lines of a block into code, because they see a code block. It also causes problems with the many, many editors who use the conventional way with code fences to add syntax highlighting, resulting in edits that add incorrect indentation to every line in a code block (and I don't have time to reject all of them). | |
Jun 1, 2022 at 4:32 | comment | added | Karl Knechtel | @OlegValteriswithUkraine Indeed. based on what I see in the previous questions that I linked, people will complain it "only enables the help vampires", that this stuff is posted by people who don't care anyway, that the suggested edits are futile, etc. I disagree with them, from my experience; there are plenty of questions where poor code formatting is the only sign of not caring, and everything else suggests that OP just can't figure out what is missing (or extra) in the post. Poor code formatting is consistent with that mindset; the preview can be skipped over easily enough. | |
Jun 1, 2022 at 4:25 | comment | added | 0Valt | [2/2] no better than the original (and some manage to make it worse). In turn, this creates even more busywork for reviewers, and, subsequently, to those who are watching the watchers. One of the many issues with formatting with whitespace is broken code blocks because users can't be bothered to look at their post twice (granted, SE's UI obsession to make as little use of available screen space as possible does not help, but that's another matter) has consistently been the source of wasting time of editors and reviewers alike for years now. | |
Jun 1, 2022 at 4:21 | comment | added | 0Valt | @CodyGray as much as it is a rare occasion, this where I support Karl's position. You are definitely right that whitespace indentation is fine (and can even be preferred), but for the sake of being pragmatic, I'd say fences have more sense - we both know that the main cause of the issue are users who never even heard of the spec, do as little as possible to format their code, and, in general, seem to be incapable of more than clicking on buttons (many times not even that). This creates a ton of busywork, f.e. filling the suggested edits queue with "formatting" edits that are often [1/2] | |
Jun 1, 2022 at 4:11 | comment | added | Karl Knechtel |
The first two problems in #3 were always there, because they come from inline code spans. Adding extra spaces to each line is tedious and error prone, both from personal experience and from noticing patterns in wrongly formatted code in the Python tag. It is very common for people to indent only the first line, and I can't help but assume this is because they think that's how it's supposed to work. Indented text doesn't intuitively connote "preformatted text" to me; it connotes "block quotation" (even though we use > for that).
|
|
Jun 1, 2022 at 4:06 | comment | added | Cody Gray Mod | Fences actually create the problems described in your #3, which were never problems before fences were introduced as an option. | |
Jun 1, 2022 at 4:06 | comment | added | Cody Gray Mod | Meh. I strongly prefer indented code blocks to code fences. The real problem there is Python. The blank lines and the indentation are more than sufficient to delineate the code. Requiring blank lines is obvious; in Markdown, the Markdown is supposed to be readable, not just the formatted output. Specifying a language can be done just about as easily as code fences, but differently. It is covered in the documentation. And, yes, it requires adding extra spaces to the lines. So what? Easy to do manually (I do it all the time), or by selecting all and clicking the toolbar button. | |
Jun 1, 2022 at 3:56 | comment | added | Ryan M Mod | I almost reflexively fixed the end of your post after having seen this so many times...nice touch :-) | |
Jun 1, 2022 at 3:56 | history | edited | Karl Knechtel | CC BY-SA 4.0 |
added 29 characters in body
|
Jun 1, 2022 at 3:49 | history | asked | Karl Knechtel | CC BY-SA 4.0 |