15

Off the back of Code blocks surrounded by single backtick then triple backticks, it looks like the original problem was not exactly resolved, but more reversed.

I'm seeing a lot of questions come through the Wizard with the following

```
`some
multi-line
code`
```

Some examples:

There's obviously still a usability issue when pasting code and / or mashing buttons.


Addendum: Is there a way to force new users to preview their post before publishing, even when using Markdown Mode? I see so many questions every day where the code is a garbled mess because it's not Markdown-formatted or in the case of HTML, completely invisible.

7
  • 5
    I guess I've become jaded, but I think many just don't care, and for a good number even the concept of proofreading is beyond comprehension, sadly :( So even if you try to force them to look at it (I mean they already can after they post and there's the edit option) it will be just another step to skip or circumvent in some other low effort fashion (it's not unusual to see people just type some garbage to satisfy the wizard).
    – Dan Mašek
    Commented Jan 15, 2023 at 22:38
  • @DanMašek I'd like to believe that at least some do care. The number of times I've had to point out that questions can be edited leads me to think that they didn't mean to post unreadable garbage, they just don't know how to fix it. I'm talking about the posts that are HTML / PHP / XML where the code is literally invisible. Providing a preview would circumvent that.
    – Phil
    Commented Jan 15, 2023 at 22:44
  • 1
    Or maybe a warning something like: "95% of what you've included in your question isn't going to be displayed. Did you include some code that's not in code format?"
    – Makyen Mod
    Commented Jan 16, 2023 at 3:54
  • 1
    @Makyen I imagine detecting that would be difficult (or at least more effort than anybody is probably willing to commit to)
    – Phil
    Commented Jan 16, 2023 at 3:56
  • 2
    @Phil I'd expect that's it's only moderately difficult, at least for the bulk that's not going to be displayed at all. To be clear, I'm not suggesting detecting generic code that's not in code format, which is a much harder problem, just detecting there's substantial/any that's going to be stripped. SE strips all HTML that isn't within a very limited set. It's definitely possible to detect that there's text in the Markdown which is going to be stripped out. I've done something fairly similar for SE's set of HTML both programmatically and as a regex.
    – Makyen Mod
    Commented Jan 16, 2023 at 4:06
  • 3
    Users with the minimum effort attitude are not interested in any of that. They just want an answer with the absolute minimum effort. If they can shave off a few hundred milliseconds by leaving out a (critical) word, they will do it. Commented Jan 16, 2023 at 11:59
  • 1
    Relevant PR on the Stacks-Editor repo. Commented Jan 30, 2023 at 13:42

1 Answer 1

4

Given the high amount of questions presenting code blocks formatted incorrectly, with the support of our designers, we have decided to make 2 small UX adjustments to the editor menu commands (see screenshot):

  • Code-Block and Code-Inline commands are now placed side by side
  • Hovering on those 2 commands provides an additional short description to help less experienced users understand when they should use what

The reason why we are making the adjustment is because we have found that the code block command, which had formerly been located among other block elements, was harder for users to locate. This confusion led to users occasionally selecting the Code-Inline instead of Code-Block.

Editor displaying the new tooltip text for the code block command: Multiline block of code with syntax highlighting

1
  • 1
    Perhaps I'm missing something but isn't that the Stack Snippet button?
    – Phil
    Commented Feb 15, 2023 at 1:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .