Commas and periods with quotation marks
Commas and periods go inside quotation marks.
Recommended: See the section titled "Care and feeding of the emu."
Not recommended: See the section titled "Care and feeding of the emu".
Exception: When you put a keyword or other literal string in quotation marks, put any other punctuation outside the quotation marks. In those cases, the quotation marks indicate an exact literal string, so don't add anything extraneous inside the quotation marks. However, in general, don't put quotation marks around an item that's in code font, unless the quotation marks are part of the item.
Recommended: If you enter
the program crashes.
Acceptable: If you enter "escape", the program crashes.
Not recommended: If you enter "escape," the program crashes.
Straight and curly quotation marks
Most typefaces support two forms of quotation marks and apostrophes: straight marks and curly, or typographic, marks. Some tools, like Google Docs, automatically convert straight quotation marks and apostrophes to the curly versions as you type. However, our guidance is to always use straight quotation marks and straight apostrophes for the following reasons:
- It's easy to get the direction of curly quotation marks (especially apostrophes) wrong. Using straight marks avoids this problem.
- Code requires straight marks.
- Many writers use coding tools (for example, Subversion) for working directly with markup. Because these tools do not produce curly marks by default, the writer must manually insert the marks, which is error-prone.
In the following examples, the first example uses straight quotation marks and the second example uses curly quotation marks:
Recommended: The section's title is "Care and feeding of the emu."
Not recommended: The section’s title is “Care and feeding of the emu.”
Single quotation marks
The only times to use single quotation marks in our documentation are the following:
- In code examples, in languages that use single quotation marks.
- When nesting a quotation inside another quotation.
In the latter case, put the primary speaker's quote in double quotation marks and the quote inside the primary speaker's quote in single quotation marks.
Recommended: She said, "I heard him shout 'Help,' and saw him floundering in the water."
Not recommended: She said, 'I heard him shout "Help", and saw him floundering in the water'.