code: function quotes(node, index, parent) {
    var siblings = parent.children
    var value = node.value
    var next
    var nextNext
    var prev
    var nextValue
  
    if (value !== doubleQuote && value !== singleQuote) {
      return
    }
  
    prev = siblings[index - 1]
    next = siblings[index + 1]
    nextNext = siblings[index + 2]
    nextValue = next && nlcstToString(next)
  
    if (
      next &&
      nextNext &&
      (next.type === punctuation || next.type === symbol) &&
      nextNext.type !== word
    ) {
      // Special case if the very first character is a quote followed by
      // punctuation at a non-word-break. Close the quotes by brute force.
      node.value = closingQuotes[value]
    } else if (
      nextNext &&
      (nextValue === doubleQuote || nextValue === singleQuote) &&
      nextNext.type === word
    ) {
      // Special case for double sets of quotes:
      // `He said, "'Quoted' words in a larger quote."`
      node.value = openingQuotes[value]
      next.value = openingQuotes[nextValue]
    } else if (next && decadeExpression.test(nextValue)) {
      // Special case for decade abbreviations: `the '80s`
      node.value = closingQuotes[value]
    } else if (
      prev &&
      next &&
      (prev.type === whiteSpace ||
        prev.type === punctuation ||
        prev.type === symbol) &&
      next.type === word
    ) {
      // Get most opening single quotes.
      node.value = openingQuotes[value]
    } else if (
      prev &&
      (prev.type !== whiteSpace &&
        prev.type !== symbol &&
        prev.type !== punctuation)
    ) {
      // Closing quotes.
      node.value = closingQuotes[value]
    } else if (
      !next ||
      next.type === whiteSpace ||
      ((value === singleQuote || value === apostrophe) && nextValue === 's')
    ) {
      node.value = closingQuotes[value]
    } else {
      node.value = openingQuotes[value]
    }
  }
docs: Transform straight single- and double quotes into smart quotes.