In the past couple of weeks, I have seen a lot of new coding questions posted where the code pasted in shows:
When helping someone, I usually copy/paste their solution into something like replit.com to see what their code does. Over the last 2 weeks, I have had to replace the curly quotes with straight quotes. Anyone else notice this? Is there an editor which uses curly quotes instead of straight quotes?
Seems like it only shows up when people don’t “fenced” their code. Which is a pain because a lot of people haven’t learned how to do that yet (I also copy/paste into codepen).
"fencing code seems to stop this."
I think admins can edit a post to wrap code in fences, but they’re busy too. We’ll just have to be polite in asking OPs to edit their posts.
(Edit: As @SkyC said. I should have read your post twice first instead of posting the same thing as you. )
What does that mean? When I attempted to search what this meant I just got a bunch of references to quotes about fences.
If you mean using an open quote and closing quote - isn’t that how they are always used?
This can happen if keyboard language is changed. Having used the french keyboard I can attest that
" " becomes
“ ” on some computers.
You’re right. I used a fancy term when I should have demonstrated.
Code fencing is when you wrap blocks of code in triple back-ticks. So, 3 of these bad boys: ```
In your post, you would start and end your code block like this:
3 little backticks above
// Heres's where your code goes
3 little backticks below
Code fencing itself is something that Github uses (but might not be a Github invention) and is an addition to Markdown (which the fCC post editor window supports).
Ok, thanks for explaining. I thought it related to quotes but now I understand it relates to backticks.
Yes backticks are tricky for the uninitiated. They work well on one line if what you want to format is one line, but if you have a multi-line block to format it’s best to use opening triple ticks on the first line, then start your text (or code or whatever) on the second line, then finish with closing backticks on their own line, as you demonstrated. I learned it the hard way after several code posts.
Even if people paste their code in with the 3 backticks, I am still seeing the curly quotes sometimes.
That’s probably user error, due to copying/pasting from somewhere with curly quotes.
Well, I have been a member of the forum since January and have only seen the curly quotes in the last couple of weeks, so I think something has changed besides just user error. Wherever they are copying from, it must not be an error when they run there code.
That is curious. I hope it’s just a fluke and not the norm. I haven’t seen quote marks changing in code, but I’ll definitely be looking for it now (especially in my own… would hate someone to copy/paste my code snippets and have them not work because of that).
Thanks for the heads-up.