In a discussion about adding a triple back-tick button to the Discourse editor for easier code posting, jayfella proposed the feature to support jmonkeyengine.org’s code-heavy community. TechnoBear noted the existing </> button for pre-formatted text, though it requires highlighting code first. jayfella clarified that their community prefers syntax-highlighted code blocks over plain preformatted text, and users often struggle with correct tick usage (e.g., vs. ```). [riking](/t/-/27310/4) pointed out a site setting that automatically applies syntax highlighting to all preformatted code blocks — a solution [jayfella](/t/-/27310/5) enabled after realizing it had been overlooked. [Mittineague](/t/-/27310/6) cautioned that while helpful, the setting won’t fully solve user confusion, sharing educational clippings they’ve used to teach proper code formatting (e.g., inline with \code` and blocks with ```code```). erlend_sh shared a link to a syntax-highlighting code block plugin as an even more useful enhancement. Sailsman63 later asked if the feature was ever implemented, noting recurring user confusion on the site. The thread highlights community desire for a simpler, more intuitive code formatting experience — ideally via a dedicated triple back-tick button — while acknowledging workarounds like site-wide syntax highlighting and user education.
Would it be possible at all to add a button to the editor for users to post code (three back-ticks)? Our website at jmonkeyengine.org relies heavily on users posting code to help with their issues, and it’s become something of a pet hate seeing code put in every tag possible except the correct one.
If it can be done via some sort of plugin or amendment, please do throw me a bone and i’ll happily implement it, if only for my waning sanity.
The editor already has the </> button for code. (Personally, I don’t like it as it requires highlighting the code and then using the button, and I find it easier to manually insert the backticks, but that’s just me.) If your members are not using that, is there much hope of them using another?
(And you have my sympathy - we have a similar problem.)
That button is for pre-formatted text, and we (albeit niche-ly) greatly prefer highlighted code. I do see your point, but trying to explain which type of tick to use, ( ` or ’ or - or some other types) gets confusing because it’s not in the same place on every keyboard around the world and it’s not easily distinguishable from the others. Is it possible at all to add your own buttons, or is this a planned feature maybe?
It should ease the problem, but don’t set your hopes too high of it completely solving the problem
I’ve been trying the “education” route with the below “clippings”, but even then some members just don’t seem to get it time after time even when they are no longer New, and from what I’ve heard, some keyboards don’t have a backtick character
EDIT
This post has been reformatted by enclosing the code block in 3 backticks
```
on their own lines.
EDIT
This post has been reformatted by enclosing the inline code with backticks
`
before and after the code.
Did this ever happen? It came up on www.hub.jmonkeyengine.org again yesterday. Apparently, some users have had the pre-formatted button strip out things like extra newlines, etc.