1

At least on stackoverflow, new users tend insert their code using the {} "code sample" button in the formatting bar, which uses 4 spaces to pad the code.

And I've seen several times when that formatting goes awfully wrong, especially when it has html tags. For users its hard to count and maintain that 4 spaces padding.

Here's an example of things going wrong that I've faced recently: https://stackoverflow.com/posts/56364987/revisions

So, a small mistake that can be easily made leads to incomprehensible questions and answers.

While reading such a post, most newcomers wont know that something went wrong and experienced users might not bother checking the original post markdown source via editing it.

As it is mentioned in this answer https://meta.stackexchange.com/a/327784/485044 — text blocks that are wrapped in ``` ... ``` are now the common way to share a code or a console output.

My question is can we alter the {} button behavior to use the ``` ... ``` blocks by default instead of the space padded blocks? Thus having more stable and bulletproof results.

Update: I should've mentioned that sometimes the system of auto-language detection fails to properly format the code, hence to make the code readable one needs to convert padded code section into a code section with backticks. Which is quite a task, since you need a separate code editor to properly remove those extra paddings.

Also, to support my point, I'll insert this text with a bit of HTML:

    Hello
   <div>
        <i>world</i>
        <OfHiddenPossibilities />
    </div>

    <br />

Here:

Hello

world

<br />

--

Thanks

You must log in to answer this question.

Browse other questions tagged .