Quotation Marks and Apostrophes
Single and double quotation marks are not rendered as curved quotation marks (also known as smart, curly, typographic, or book quotation marks).
When entered using the ' and " key, Asciidoctor outputs straight quotation marks (also known as vertical or typewriter quotation marks).
However, by creating a pair of backticks (
`) contained within a pair of single quotes (
') or double quotes (
"), you can tell Asciidoctor where to output curved quotation marks.
"`What kind of charm?`" Lazarus asked. "`An odoriferous one or a mineral one?`" (1) Kizmet shrugged. "`The note from Olaf's desk says '`wormwood and licorice,`' but these could be normal groceries for werewolves.`" (2)
|1||To output double curved quotes, enclose a word or phrase in a pair of double quotes (
|2||To output single curved quotes, enclose a word or phrase in a pair of single quotes (
The result of Example 1 is rendered below.
“What kind of charm?” Lazarus asked. “An odoriferous one or a mineral one?”
Kizmet shrugged. “The note from Olaf’s desk says ‘wormwood and licorice,’ but these could be normal groceries for werewolves.”
When entered with the ' key, Asciidoctor renders an apostrophe that is directly preceded and followed by a character, such as in contractions and possessive singular forms, as a curved apostrophe. This inconsistent handling of apostrophes and quotation marks is a hold over from the original AsciiDoc processor. An apostrophe directly bounded by two characters is processed during the replacements substitution phase, not the inline formatting (quotes) phase. This is why an apostrophe directly followed by white space, such as the possessive plural form, is not curved by default.
To render an apostrophe as curved when it is not bound by two characters, mark it as you would a single curved quote.
Olaf had been with the company since the `'00s. His desk overflowed with heaps of paper, apple cores and squeaky toys. We couldn't find Olaf's keyboard. The state of his desk was replicated, in triplicate, across all of the werewolves`' desks.
In the rendered output, note that the plural possessive apostrophe, seen trailing werewolves, is curved, as is the omission apostrophe before 00s. The result of Example 2 is rendered below.
Olaf had been with the company since the ’00s. His desk overflowed with heaps of paper, apple cores and squeaky toys. We couldn’t find Olaf’s keyboard. The state of his desk was replicated, in triplicate, across all of the werewolves’ desks.
If you don’t want an apostrophe that is bound by two characters to be rendered as curved, escape it by preceding it with a backslash (
The Escape and Prevent Substitutions and Inline Passthroughs pages detail additional ways to prevent punctuation substitutions.
Olaf\'s desk ...
The result of Example 3 is rendered below.
Olaf's desk …
In order to make a possessive, monospaced phrase, you need to switch to unconstrained formatting followed by an explicit typographic apostrophe.
``npm```'s job is to manage the dependencies for your application.
The result of Example 4 is rendered below.
npm’s job is to manage the dependencies for your application.
The same goes if the monospaced phrase ends in an “s”.
This ``class```' static methods make it easy to operate on files and directories.
The result of Example 5 is below. The word class is rendered in monospace with a curved apostrophe at the end of it.
class’ static methods make it easy to operate on files and directories.
Alternately, you could encode the typographic apostrophe directly in the AsciiDoc source to get the same result without the need to use unconstrained formatting.
The `class`’ static methods make it easy to operate on files and directories.