Disable Code Formatting for inappropriate 4 space indent?

Hi,

In my community, no one should ever post code. It would always be off-topic.

However, sometimes people do have their posts formatted as code by accident.

Is it possible to disable everyone from applying the ‘code’ format to content in their post?

3개의 좋아요

How do they use a code by mistake? By clicking the code button in the editor? Or simply leaving 4 spaces at the beginning of the line?

You can try to hide the code button with CSS using:

.code.btn {
    display: none;
}

You can also change the site setting code formatting style from the default 4-spaces-indent to code-fences. If users can leave 4 blanks spaces before a line (maybe because they use emails?) it is difficult for them to use ``` by mistake.

5개의 좋아요

In my case it’s always the user’s email app adding an indent at the first line in a paragraph. Their posts by email are jumbled up as a result.

More here:

4개의 좋아요

Hi @dax,

Those are great ideas - I’ve implemented both. Thank you!

I do think it is because they add four spaces to the start of a line. I wonder if this was a typing convention in some schools or something? Or it is entered via their email program? It seems to happen a couple of times a week.

That is/was the standard way to create a paragraph when writing on paper:

5개의 좋아요

I doubt they insert manually 4 space. I think instead that they write the posts via email. You should be able to determine this by looking at the post itself. If you see an envelope icon the post has been submitted by email.

image

Or they simple copy paste the text from an another program where they use the Tab to create new paragraphs,

3개의 좋아요

You would be surprised! I had hundreds of users, in a instance where reply by email was disabled, putting the four spaces because they were mimicking pen and paper standards. They also did the same when using a word processor or email.

7개의 좋아요

The Thunderbird email client does it automatically for some of my users. :unamused:

3개의 좋아요

Dax님, 이 설정을 'code-fences’로 설정해도 시스템이 여전히 4개의 공백을 코드 포맷으로 변환하는 것을 확인했습니다. 사이트 전체에서 4개의 공백 = 코드 마크다운/포맷을 비활성화하는 방법이나 옵션이 있을까요?

질문하는 이유는 일주일에 몇 번씩 참가자가 실수로 코멘트를 코드 형식으로 게시해서 읽기 어렵게 만들기 때문입니다. 일부 사람들에게는 여전히 이 관행이 유효하다고 생각합니다:

4개의 좋아요

아니요, 그렇게 할 수 있는 방법은 없습니다.

4개의 좋아요

합리적입니다!

이것을 기능 요청으로 간주해 주십시오.

코드 블록이 필요한 디스코urs 포럼이 전체의 몇 퍼센트나 될지 궁금합니다. 제 생각에는 커뮤니티 중 소수만이 해당될 것 같습니다.

3개의 좋아요

부적절한 4공백 들여쓰기에 대해 코드 포맷팅을 비활성화할까요?

@outofthebox, 이 문제를 경험한 분은 처음이 아닙니다. 이 기능을 얼마나 싫어하는지에 대한 Reddit 게시물들이 수백 개의 추천을 받은 것을 확인했으며, CommonMark 표준 Discourse 포럼에도 관련 스레드가 있습니다. 그 중 일부를 온라인으로 요약해 두었습니다: