Jump to content

Is there code to show curly quotes in all typography, but only straight quotes in code blocks?

Go to solution Solved by creedon,

Recommended Posts

I want to ensure that all quotation marks in my site's user-facing content, eg. my blog posts, utilize the typographically correct (and aesthetically pleasing) curly quotes. My preferred curly quotes are frequently replaced by straight quotes (which are used in code as well as for denoting measurements in inches and feet).

Here's a visual that explains the difference between straight quotes and curly quotes and what I'm trying to accomplish.

Here's an example blog post that uses many curly quotes throughout.

Squarespace seems to choose erratically to randomly apply straight quotes or curly quotes, and it's not always easy for me to change them to the proper version.

While I want curly quotes on the user-facing content, I need to ensure that straight quotes are exclusively used in code blocks because otherwise it creates bugs: The other day, Squarespace chose to randomly apply curly quotes within a code block, and this rendered the code block nonfunctional. When I tried re-typing the proper straight quote over and over again, Squarespace kept switching it to a curly quote. I eventually got it working by copying a straight quote from elsewhere within the code block then, pasting that. And vice versa: At other times in the past, when I tried typing a curly quote in a blog post or site content, Squarespace kept changing it to a straight quote. Super frustrating. 

I don't understand Squarespace's logic for making a quote straight or curly. 

I want to be able to control this logic using a code injection. 

Any advice would be appreciated.

Link to comment

I don't have a specific solution just some observations.

This is for the v7.1 rich text editor.

Typing a single quote gives you a smart quote. Hitting the backspace key turns it into a dumb single quote.

Pasting text with smart single quotes from Google Docs or any Word Processor, preserves the smartness.

Pasting text with dumb single quotes from a code editor like BBEdit, preserves the dumbness.

Code with smart quotes in it are preserved when pasted into a code block.

Code with dumb quotes in it are preserved when pasted into a code block.

My general experience has been when code blocks get smart quotes they were picked up because the code passed through a word processor, not a code editor.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
20 hours ago, creedon said:

My general experience has been when code blocks get smart quotes they were picked up because the code passed through a word processor, not a code editor.

This is so interesting — I wonder if this is why the stubborn smart quote issue I was having when pasting in my code block is because I composed it in my Mac's Notes app then copy-pasted it from there! 💡

I'll try to avoid that in the future (maybe with a non-rich-text TextEdit file since I don't have a code editor app).

Thanks @creedon for helping me solve part of this mystery.

Edited by lightbulbmoments
Link to comment
  • Solution
On 4/16/2023 at 12:20 PM, lightbulbmoments said:

maybe with a non-rich-text TextEdit

TextEdit is not a full word processor but it is more like them than a code editor, in that it works with multistyle text. I've never tried editing code in it. The first thing to look for is if it makes dumb quotes smart.

Some word processors have an option to turn off dumb quote conversion.

The BBEdit I mentioned is for macOS and is the premier code editor. It has syntax highlighting, cold folding, and a bunch of other useful options. If you need a free option Xcode is Apple's mac development editor but it also has the overhead of project management.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.