|
|
@ -41,7 +41,7 @@ function arrayReplaceAt(src, pos, newElements) { |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var UNESCAPE_MD_RE = /\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g; |
|
|
|
var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g; |
|
|
|
|
|
|
|
function unescapeMd(str) { |
|
|
|
if (str.indexOf('\\') < 0) { return str; } |
|
|
@ -223,6 +223,54 @@ function isPunctChar(char) { |
|
|
|
return BMP_PUNCT_RE.test(char); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Markdown ASCII punctuation characters.
|
|
|
|
//
|
|
|
|
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
|
|
// http://spec.commonmark.org/0.15/#ascii-punctuation-character
|
|
|
|
//
|
|
|
|
// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
|
|
|
|
//
|
|
|
|
function isMdAsciiPunct(ch) { |
|
|
|
switch (ch) { |
|
|
|
case 0x21/* ! */: |
|
|
|
case 0x22/* " */: |
|
|
|
case 0x23/* # */: |
|
|
|
case 0x24/* $ */: |
|
|
|
case 0x25/* % */: |
|
|
|
case 0x26/* & */: |
|
|
|
case 0x27/* ' */: |
|
|
|
case 0x28/* ( */: |
|
|
|
case 0x29/* ) */: |
|
|
|
case 0x2A/* * */: |
|
|
|
case 0x2B/* + */: |
|
|
|
case 0x2C/* , */: |
|
|
|
case 0x2D/* - */: |
|
|
|
case 0x2E/* . */: |
|
|
|
case 0x2F/* / */: |
|
|
|
case 0x3A/* : */: |
|
|
|
case 0x3B/* ; */: |
|
|
|
case 0x3C/* < */: |
|
|
|
case 0x3D/* = */: |
|
|
|
case 0x3E/* > */: |
|
|
|
case 0x3F/* ? */: |
|
|
|
case 0x40/* @ */: |
|
|
|
case 0x5B/* [ */: |
|
|
|
case 0x5C/* \ */: |
|
|
|
case 0x5D/* ] */: |
|
|
|
case 0x5E/* ^ */: |
|
|
|
case 0x5F/* _ */: |
|
|
|
case 0x60/* ` */: |
|
|
|
case 0x7B/* { */: |
|
|
|
case 0x7C/* | */: |
|
|
|
case 0x7D/* } */: |
|
|
|
case 0x7E/* ~ */: |
|
|
|
return true; |
|
|
|
default: |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
exports.assign = assign; |
|
|
@ -236,5 +284,6 @@ exports.escapeHtml = escapeHtml; |
|
|
|
exports.arrayReplaceAt = arrayReplaceAt; |
|
|
|
exports.normalizeLink = normalizeLink; |
|
|
|
exports.isWhiteSpace = isWhiteSpace; |
|
|
|
exports.isMdAsciiPunct = isMdAsciiPunct; |
|
|
|
exports.isPunctChar = isPunctChar; |
|
|
|
exports.escapeRE = escapeRE; |
|
|
|