blob: f11639ffc071bb6c776f5d92d04c1d19b1740d05 [file] [log] [blame]
'use strict'
module.exports = enclose
var quotationMark = '"'
var apostrophe = "'"
// There is currently no way to support nested delimiters across Markdown.pl,
// CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl
// and GitHub.
// CommonMark is not supported when mixing double- and single quotes inside a
// title.
function enclose(title) {
var delimiter =
title.indexOf(quotationMark) === -1 ? quotationMark : apostrophe
return delimiter + title + delimiter
}