How can i set disable Markdown & Default to Rich Text

We’d like to configure the editor so that Markdown is not an available option**. Users should **not be able to select different editor types, and rich text should be set as the default.

I now have admin rights. What’s the best way to set things up?

7 Likes

I couldn’t find the relevant settings

I solved it using a MutationObserver

1 Like

Thanks for requesting this, there is no option at the moment but we are considering adding one

Maybe @renato or @david can help come up with a simple component to do this that does not rely on mutation observer, that feels fragile

4 Likes

Alternatively, you could simply hide the editor toggle switch with CSS. I imagine that’s a bit simpler than using MutationObserver.

To do so, simply install a new component here: https://discourse.yoursite.com/admin/config/customize/components

Then, add a little CSS snippet to the code for that component that looks like so:

.composer-toggle-switch {
  display: none;
}

I used this to enforce the default Markdown editor, since the rich editor does not (yet) work well with the Discourse Math plugin.

4 Likes

The rich text editor mode is also now the default:

1 Like

The rich text editor is available on all sites, and you can use the default composition mode setting to determine what your members will see when they open the composer for the first time. It’s set to rich text by default.

Members, though, can decide to use the composer toggle to switch back to Markdown mode. The composer will then remember this as their preferred mode, so it will reopen in Markdown mode until if / when they switch back to rich text.

The idea here is that we want to let members write in the composer that works best for them — admins know their communities and can make a reasonable choice about which default makes the most sense, but members should be able to choose a different mode if it works better for them.

6 Likes

I believe that might seem like the reasonable behavior for most forums. I use my forum, though, as a Q&A site for my college students studying mathematics, statistics, and data science. Learning Markdown and LaTeX is part of the point.

I have no doubt that many of them want to use the rich editor. They really need to use the Markdown editor, though. So, I’m glad I can enforce this by setting the Markdown editor as the default and hiding the toggle switch with CSS. :slight_smile:

7 Likes

Sounds like you found a solution that works well for your community’s specific needs — that’s great!

2 Likes

I don’t understand. The update is overriding our previous defaults. This created issues with CSS for me.

I’m now trying to disable rich text completely for now at least.

@mcmcclur This worked for me to hide switch. Thanks!!

.composer-toggle-switch {
  display: none;
}

I’m becoming so scared of updates now. Every time recently updating discouse results in extra work with these forced overrides/changes and additions. :confused:

There is of course another route to choose — don’t paint yourself on the corner :smirking_face:

I mean, let users decide what they want and don’t do definitive rules. It takes away quite many reasons to be afraid.

Exactly. I agree, this should apply to forum owners as well. Didn’t get to decide. Updated and, boom… it’s changed for me and with an unintended css issue.

But yes, I will bring it back once that is solved. But not by changing it to the rich text editor for all users, but instead letting them know that they have a new option and can decide.