不適切な4スペースインデントに対するコードフォーマットの無効化は可能か?

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?

「いいね!」 2

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:

「いいね!」 3

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:

「いいね!」 4

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.

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 つのスペース = コード」のマークダウン/書式設定を無効にする方法やオプションはありますか?

質問の理由は、週に数回、参加者が誤ってコメントをコード形式で投稿し、読みづらくなってしまうからです。これは、一部の人々の間でまだこの慣習が根強く残っているためだと思われます。

「いいね!」 3

いいえ、そのような方法は存在しません。

「いいね!」 4

なるほど!

これは機能リクエストとしてお考えください。

Discourse フォーラムの何%がコードブロックを必要としているのでしょうか?私の感覚では、それはコミュニティのごく一部ではないでしょうか?

「いいね!」 3