Triple back-tick button in the editor

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?

There’s a site setting to apply highlighting to all preformatted text blocks, which it sounds like may be appropriate for you.

4 Likes

Thanks @riking - that setting slipped right past me. I’ve enabled it for now to see if it at least alleviates the issue. Much appreciated.

It should ease the problem, but don’t set your hopes too high of it completely solving the problem :sadpanda:

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.

Cheers riking, that one slipped by me too. Most useful of all would be this though:

https://meta.discourse.org/t/syntax-highlighting-of-code-blocks/7242/24?u=erlend_sh

5 Likes

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.