Skip to content
The style guide is in beta: content and structure may change.

Quotation marks

Quotation marks set off quoted text and literal values, and in code they are syntax. This page covers how to write them in body text and in code, and where the punctuation around them goes.

punct-006 should GuidesAPI docsMarketingBlog

Use straight quotation marks in code samples and code font regardless of the convention used in body text.

Examples

  • print("Hello")
  • print(“Hello”)

Rationale

Programming languages and shells treat curly quotation marks as different characters or invalid syntax. Code copied with a curly quotation mark can fail.

punct-007 should GuidesAPI docsMarketingBlog

Place periods and commas inside closing quotation marks in body text.

Examples

  • ✓ The spec calls this “the happy path.”
  • ✗ The spec calls this “the happy path”.

Rationale

Placing periods and commas inside closing quotation marks follows American English convention and keeps body text consistent.

punct-008 should GuidesAPI docsMarketingBlog

When a literal string or keyword is in quotation marks, place any surrounding punctuation outside the quotation marks.

Examples

  • ✓ Set the status to “active”.
  • ✗ Set the status to “active.”

Rationale

When punctuation belongs to the sentence rather than the quoted literal, placing it outside the quotation marks shows that it isn’t part of the value.

punct-022 should GuidesAPI docsMarketingBlog

Don’t use single quotation marks in body text except when nesting a quotation inside another quotation or in code examples that require them.

Examples

  • ✓ The response includes the note “retry later.”
  • ✗ The response includes the note ‘retry later.’

Rationale

Double quotation marks distinguish quoted text from apostrophes. Single quotation marks remain available for a quotation inside another quotation and for code that requires them.