Disable automatic conversion of ASCII quotation marks to curly

Discourse automatically converts ASCII quotation marks (" ") to curlies (“ ”) when placed around text, except inside code blocks.

For example, here I’m typing the same thing twice: “Hello world”, "Hello world". As you can see, outside the code block the quotation marks turned curly.

Since newcomers often fail at properly putting their code inside code blocks, this “feature” makes it more difficult than necessary to copy their code when trying to reproduce a problem.

If possible, this conversion should be disabled.

Curly quotes are the least of your problems; all indentation is stripped :slight_smile:

Ideally, users would use code blocks correctly (as is suggested when they try to post), but if you want to try to help someone who didn’t, you can get the raw text of their post by replacing /t/whatever-the-topic-slug-is/ portion of the URL with /raw/: see your post at https://discuss.python.org/raw/20904.

Personally, I wish that view was made more easily findable; as far as I know, there’s no way to reach it via the UI, but instead manual URL manipulation is required.


Given that unformatted code would still unusable (indentation, etc), I don’t see what benefit removing the nice formatting from non-code test offers. Personally I just refuse to spend effort on questions until/unless code gets formatted.

Supposedly there was a plugin installed that would try to detect unformatted code, and pop up a modal dialog to prompt the user to correct it, but if so, it does not seem to be very successful. Does Discourse have a an mandatory onboarding flow that could be enabled? e.g. show new users how to make a formatted code block, and make them literally type one in correctly in some dialog before they are allowed to post for the first time?


The lost indentation is a bigger problem, but also harder to do anything about. The quotation marks are a hurdle, albeit minor, and if possible I don’t see the downside to removing it. IMO the typographic benefits of curly quotation marks over straight are minor at best.

That’s very useful, thanks!

This would perhaps be the ideal solution. Such a plugin doesn’t seem to exist, unfortunately.

See Unformatted Code Detector though.

Yes, but as Bryan noted, that has only been moderately successful. People are still posting unformatted code in the ‘Help’ section every day.

Oh, I’m sorry. I wasn’t paying enough attention and misread Bryan’s post.

Well, but is the plugin actually installed? Can you point me to where admins announced this? I wanted to see how it looked like, but trying the exact same example as on Unformatted Code Detector - theme-component - Discourse Meta in Unformatted Code Detector - #4 by jeanas, the post got sent without any warning…

Hmm, I could have sworn I’ve seen that warning myself previously, but indeed, no warning now. Strange.

This would perhaps be the ideal solution. Such a plugin doesn’t seem to exist, unfortunately.

I opened a discussion on Meta to solicit thoughts, so we will see :man_shrugging:


Well, it is enabled actually, Unformatted Code Detector - #8 by jeanas.

If it’s not working well, it means their heuristics have many false negatives (I suppose this is not easy to write heuristics for).

The Unformatted Code Detector plugin works but it does not detect short core :frowning: Few months ago someone also reported that it had not worked for them at all.

The proposed mandatory onboarding for code formatting would be great!

Meanwhile it could be helpful to create a post just about the code formatting in the welcome category and pin it there:

Then we can link it for newcomers when needed instead of writing the same instructions again and again.

I have added a section to the already pinned Quick Start message:

…but I think the section gets lost in the relatively long message and when I link the section of the message it shows the beginning of the message in the preview, not the linked section. You can see the useless preview above.

1 Like