|
|
@ -278,6 +278,27 @@ function normalizeReference (str) { |
|
|
|
return str.toLowerCase().toUpperCase() |
|
|
|
} |
|
|
|
|
|
|
|
// Removes space-like characters that are allowed to be removed in CommonMark spec.
|
|
|
|
function trimMinimalSpaces (str) { |
|
|
|
let start = 0 |
|
|
|
for (; start < str.length; start++) { |
|
|
|
if (!isSpaceLike(str.charCodeAt(start))) { |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
let end = str.length - 1 |
|
|
|
for (; end >= start; end--) { |
|
|
|
if (!isSpaceLike(str.charCodeAt(end))) { |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
return str.slice(start, end + 1) |
|
|
|
|
|
|
|
function isSpaceLike (c) { |
|
|
|
return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 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
|
|
|
|
// bundled size (e.g. a browser build).
|
|
|
@ -300,5 +321,6 @@ export { |
|
|
|
isMdAsciiPunct, |
|
|
|
isPunctChar, |
|
|
|
escapeRE, |
|
|
|
normalizeReference |
|
|
|
normalizeReference, |
|
|
|
trimMinimalSpaces |
|
|
|
} |
|
|
|