Curly quotes are the least of your problems; all indentation is stripped
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.
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.
@steven.daprano Id make a new one, referencing the old one, and emphasize that the discussion that developed there about the plugin does not help at all with the case of new users posting images of code (and also the plugin still does not really seem to work in any case)
To be fair, the first response didn’t say “You don’t want that”. It
may be that there’s no mandatory onboarding available, but the first
response at lead suggested a plugin which has some benefit for the
underlying problem which motivated the query about mandatory onboarding.
Given how often we ask people for the underlying problem they’re
trying to solve (as opposed to the specific kind of perhaps-weird
technical thing a user’s trying to make work), this isn’t unhelpful.
Maybe it would have been nice if the response had said “Discourse
doesn’t have a mandatory onboarding feature” or “I don’t know if that’s
possible, but this other thing in this problem domain exists”. But they didn’t say “no you don’t want that”.
Technically … yes this can be disabled by Discourse admins, we have the setting enable markdown typographer which amends a bunch of stuff in cooked:
Use typography rules to improve readability of text: replace straight quotes ' with curly quotes ’, (c) (tm) with symbols, -- with emdash –, etc
Glad to hear that the unformatted code detector is helping out.
I think there is some opportunity here for some GPT-4 integration to do some smart things here and catch even more of these. The unfortunate thing though is that the APIs are really slow at the moment so this would have to come after the fact.
We have enough problems with Python scoping/control info (and some
punctuation) being lost with code posted in “prose” mode. Do we really
want an LLM misparsing on top of that? It just feels like a recipe for
taking a poster’s known-to-have-a-problem code and further
Unless you’re using GPT-4 as some kind of “oh this bit is probably code,
not prose” thing, I’d rather rely on some kind of regexpy based
heuristic. At least you’d know the basis for the inferences.