mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
625 B
57 lines
625 B
'use strict';
|
|
|
|
module.exports = escapes;
|
|
|
|
var defaults = [
|
|
'\\',
|
|
'`',
|
|
'*',
|
|
'{',
|
|
'}',
|
|
'[',
|
|
']',
|
|
'(',
|
|
')',
|
|
'#',
|
|
'+',
|
|
'-',
|
|
'.',
|
|
'!',
|
|
'_',
|
|
'>'
|
|
];
|
|
|
|
var gfm = defaults.concat(['~', '|']);
|
|
|
|
var commonmark = gfm.concat([
|
|
'\n',
|
|
'"',
|
|
'$',
|
|
'%',
|
|
'&',
|
|
'\'',
|
|
',',
|
|
'/',
|
|
':',
|
|
';',
|
|
'<',
|
|
'=',
|
|
'?',
|
|
'@',
|
|
'^'
|
|
]);
|
|
|
|
escapes.default = defaults;
|
|
escapes.gfm = gfm;
|
|
escapes.commonmark = commonmark;
|
|
|
|
/* Get markdown escapes. */
|
|
function escapes(options) {
|
|
var settings = options || {};
|
|
|
|
if (settings.commonmark) {
|
|
return commonmark;
|
|
}
|
|
|
|
return settings.gfm ? gfm : defaults;
|
|
}
|
|
|