quote-quote
Version:
Convert straight quotes to curly quotes — also known as smart quotes.
21 lines (20 loc) • 863 B
TypeScript
import type { ConvertMarkdownOptions } from './types.js';
/**
* Convert straight quotes to curly quotes in text formatted as Markdown. This
* means that quotes inside code are not converted.
*
* This includes:
* - Straight single/double quotes to left/right quotation marks,
* - Straight quotes used as primes to proper prime symbols.
* - Contractions and possessives like "don't", "it's", or "John's",
*
* @param {string} text - the text that may contain straight quotes
* @param {Object} [options]
* @param {boolean} [options.ellipsis] - whether to also convert "..." to an ellipsis
* @return {string}
* @throws {TypeError} if `text` is not a `String`
*
* @example
* convert('"Hello `"world"`" they said.'); // “Hello `"world"`” they said.
*/
export declare function convertMarkdown(text: string, options?: ConvertMarkdownOptions): string;