I was trying to explain a part of a code through chat, and I noticed that there was no way to post code blocks in the chat interface. Although I agree that large codes are rarely posted in the chat interface, but I think we should have a feature to post code blocks in chat, especially since stackoverflow encourages long discussions in the comments to be continued in chat. In such cases code blocks can be necessary.
What is meta?
- Any Stack Exchange user can ask a question
- The community provides support, votes on ideas, and reports bugs
- Your voice helps shape the way Stack Exchange operates
The feature is already there. Just preface each line with 4 spaces, like you would on the site.
If you don't want to do this manually, press the
And if you're not copy/pasting code in, remember you can use Shift+Enter to add a line break instead of sending the message, and then you just either add 4 spaces as you go along or use the button/shortcut at the end.