# Suggest users to use code block when pasting code snippet

**URL:** https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020
**Category:** Support
**Created:** [May 21, 2025, 10:38am UTC](https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020 "2025-05-21T10:38:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stefl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stefl/32/503956_2.png) [@stefl](https://meta.discourse.org/u/stefl)
#### Post date: [May 21, 2025, 10:38am UTC](https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020/1 "2025-05-21T10:38:44Z")

</div>

We use discourse to run a user support forum about programming and related technical activities. New (or less technically savvy) users are not immediately familiar with this forum environment and naively paste code snippets (e.g. Python code) in a text box without appropriate code fences (e.g. triple backticks), which is often hard to read because the code indentation (and possibly some syntax constructs) are completely ruined.

Is there some approach/plugin to do something like:

- detect that a user is pasting a code snippet without appropriate markers/fences (detection of source code could be configurable, based on commonly used languages or programming patterns for the forum)
- and then show a simple popup/overlay/notificaion saying something along the lines of “Hey, it looks like you are pasting source code, make sure to put it a preformatted text block for optimal readability”, pointing to the button to do this

?

thanks in advance for any pointer

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [May 21, 2025, 10:49am UTC](https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020/2 "2025-05-21T10:49:13Z")

</div>

Welcome to Meta 👋

Maybe this theme component is what you are looking for

> [@Unformatted Code Detector](https://meta.discourse.org/t/unformatted-code-detector/112773):
>
> discourse2Summary Unformatted Code Detector detects unformatted code and gives a warning before posting.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/unformatted-code-detector)hammer_and_wrenchRepository Link [https://github.com/discourse/unformatted-code-detector](https://github.com/discourse/unformatted-code-detector)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features Users posting unformatted code will see a warning message instructing them how to format it correctly…

---

<div class="post-metadata">

### Author: ![stefl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stefl/32/503956_2.png) [@stefl](https://meta.discourse.org/u/stefl)
#### Post date: [May 21, 2025, 11:10am UTC](https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020/3 "2025-05-21T11:10:13Z")

</div>

Great, looks exactly like what I was hoping for  
thanks for the quick answer!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 20, 2025, 11:10am UTC](https://meta.discourse.org/t/suggest-users-to-use-code-block-when-pasting-code-snippet/367020/4 "2025-06-20T11:10:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
