In the discussion “Straight quotes,” users discuss the limitations of Discourse’s typographer feature in keeping straight quotes in text. Cécile_Savoie attempted to set typographer replacement pairs to keep straight quotes but was unable to enter duplicate values, forcing her to deactivate the typographer.
tshenry explains that the markdown typographer quotation marks site setting is not designed to replace fancy quotes with straight quotes. The setting was intended to support languages with multiple quote characters. With the typographer enabled, double quotes are only rendered as straight quotes in specific cases, while single quotes are always rendered fancy.
As a workaround, tshenry suggests using code blocks for sharing code, which bypasses fancy formatting. Cécile_Savoie notes that users often forget to use code blocks, making it difficult to determine if errors in code are due to typographer conversion or user mistake.
codinghorror emphasizes the importance of posting code blocks correctly, using methods such as indenting four spaces, code fences, or the code formatting button, to address the underlying issue rather than its symptoms.
" " ’ ’
in the Typographer replacement pairs for straight quotes.
That would have forced the Typographer to keep the straight quotes, while continuing to do all other usual changes (em dash tm, etc). Users would have had to specifically type curly quotes for text but that’s fine.
Unfortunately I cannot enter the same value twice in the replacement pairs field.
So I had to deactivate the typographer altogether. Was there another way to achieve our goal (not have code quotes modified)?
PS. I can see here my double quotes have remained straight but the single ones haven’t so I guess it is possible to do?
At this time it does not appear to be possible to replace the fancy quotes with straight quotes using the markdown typographer quotation marks site setting. The original intention for that setting was to support languages such as German and French that would have four different quote characters.
With the enable markdown typographer site setting checked, the double quotes will be rendered as straight only when there is a space directly after the first double quote, or a space directly before the last double quote.
Straight quotes:
" "
" foo"
"bar "
" foo bar"
"foo bar "
Fancy quotes:
“”
“foo”
“foo bar”
Single quotes (aka an apostrophe) will always be rendered fancy.
Is there a particular reason you are looking to replace the fancy quotes? For the purposes of sharing code, we suggest using code blocks to bypass the fancy formatting:
Thank you. People don’t think of using the code blocks so it’s hard to guess if they made the mistake in their code or it’s the typographer that converted straight quotes.
Nevertheless, I will check with my tribe and see if we can get them to use code blocks