Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

To answer the "punctuation inside or outside quotes?" question, ask yourself if the punctuation belongs to the quote or the sentence that contains the quote.

Keep punctuation inside when it's part of the quoted sentence.

If the quoted sentence ends but the unquoted sentence continues, periods become commas.

"How are you doing today?" he asked.
"Check out my quotes," Rob said. "This punctuation seems pretty natural."

If you do it the other way, it's all kinds of wrong.

"How are you doing today"? he asked.
"Check out my quotes", Rob said. "This punctuation seems pretty natural".

Keep punctuation outside when it's part of the sentence that contains the quote.

This is usually (but not always) the case if the quotes are being used to delineate a word or phrase that is not being spoken.

Hit the button marked "save".
Shouts of "hoooo", "damn", and "those quotes are fine" were heard among those attending.

The other way seems quite odd.

Hit the button marked "save."
Shouts of "hoooo," "damn," and "those quotes are fine" were heard among those attending.

And then there are edge cases.

What if the punctuation belonging to a quote at the end of a sentence is different than the sentence ending punctuation?

Earlier Rob asked me "What foul wizardry is this?".

That doesn't look right. Traditionally a sentence that ends in a quote gets automatic period insertion.

Earlier Rob asked me "What foul wizardry is this?"

It breaks pedantic semantics a little, but reads correctly.

What about this one, where a button is named SAVE!:

Hit the button marked "SAVE!".

Hmmmm. I would argue that the above is correct, but if I was writing for public consumption I would avoid it at all costs. Sometimes its better to rewrite to avoid the edge case altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment