|
|
@ -18,7 +18,7 @@ function has (object, key) { |
|
|
|
|
|
|
|
// Merge objects
|
|
|
|
//
|
|
|
|
function assign (obj /*from1, from2, from3, ...*/) { |
|
|
|
function assign (obj /* from1, from2, from3, ... */) { |
|
|
|
const sources = Array.prototype.slice.call(arguments, 1) |
|
|
|
|
|
|
|
sources.forEach(function (source) { |
|
|
@ -42,10 +42,9 @@ function arrayReplaceAt (src, pos, newElements) { |
|
|
|
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1)) |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
function isValidEntityCode (c) { |
|
|
|
/*eslint no-bitwise:0*/ |
|
|
|
/* eslint no-bitwise:0 */ |
|
|
|
// broken sequence
|
|
|
|
if (c >= 0xD800 && c <= 0xDFFF) { return false } |
|
|
|
// never used
|
|
|
@ -62,7 +61,7 @@ function isValidEntityCode (c) { |
|
|
|
} |
|
|
|
|
|
|
|
function fromCodePoint (c) { |
|
|
|
/*eslint no-bitwise:0*/ |
|
|
|
/* eslint no-bitwise:0 */ |
|
|
|
if (c > 0xffff) { |
|
|
|
c -= 0x10000 |
|
|
|
const surrogate1 = 0xd800 + (c >> 10) |
|
|
@ -101,11 +100,11 @@ function replaceEntityPattern (match, name) { |
|
|
|
return match |
|
|
|
} |
|
|
|
|
|
|
|
/*function replaceEntities(str) { |
|
|
|
/* function replaceEntities(str) { |
|
|
|
if (str.indexOf('&') < 0) { return str; } |
|
|
|
|
|
|
|
return str.replace(ENTITY_RE, replaceEntityPattern); |
|
|
|
}*/ |
|
|
|
} */ |
|
|
|
|
|
|
|
function unescapeMd (str) { |
|
|
|
if (str.indexOf('\\') < 0) { return str } |
|
|
@ -121,7 +120,6 @@ function unescapeAll (str) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
const HTML_ESCAPE_TEST_RE = /[&<>"]/ |
|
|
|
const HTML_ESCAPE_REPLACE_RE = /[&<>"]/g |
|
|
@ -143,7 +141,6 @@ function escapeHtml (str) { |
|
|
|
return str |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
const REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g |
|
|
|
|
|
|
@ -151,7 +148,6 @@ function escapeRE (str) { |
|
|
|
return str.replace(REGEXP_ESCAPE_RE, '\\$&') |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
function isSpace (code) { |
|
|
|
switch (code) { |
|
|
@ -182,9 +178,8 @@ function isWhiteSpace (code) { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/*eslint-disable max-len*/ |
|
|
|
/* eslint-disable max-len */ |
|
|
|
|
|
|
|
// Currently without astral characters support.
|
|
|
|
function isPunctChar (ch) { |
|
|
@ -291,7 +286,6 @@ function normalizeReference (str) { |
|
|
|
return str.toLowerCase().toUpperCase() |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Re-export libraries commonly used in both markdown-it and its plugins,
|
|
|
|
// so plugins won't have to depend on them explicitly, which reduces their
|
|
|
|