Can't make a selected text a code

why can’t i make it a code?

1 Like

Sorry,

can you please post your code as text instead of using an image

1 Like

How did you try it?

Thank you.

1 Like

There used to be a button to turn text into code.
like this one here:

But now it’s not there.

How can it help?
Actually, that button is long gone. I thought it would be fixed later, but for some reason it’s still not there.

Ah, you mean here in the forum?

You are right the button is missing.

@sableRaph bug in forum software, missing button for code (only on mobile, on a normal browser it’s there)

You can also use ctrl-e or write mark-up Test

Use this sign before and after the code (within one line):
`

And for multiple lines three of those before and after the code section :

   for {
      ...
    }

( My iPhone destroys those but on a PC it’s working)

1 Like

I previously resolved this by applying a solution found in the thread linked below, but the most recent update to Discourse has unfortunately undone that fix. I posted in the thread and plan to contact Discourse support in hopes of a resolution.

In the meantime, you can three backticks before and after a code block like so:

```
your code
here
```

2 Likes

Update: I removed the prior fix and the button reappeared in the cog menu on mobile. We would need an alternative fix to bring the button back in the header menu.

3 Likes

This should be fixed now! Let me know if you notice any further issues when formatting code.

For future reference: here is the fix I applied.

3 Likes