marked 9.1.4 → 9.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/marked.cjs +11 -5
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.cts +2 -2
- package/lib/marked.d.ts +2 -2
- package/lib/marked.esm.js +11 -5
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +11 -5
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +2 -2
- package/package.json +9 -9
package/lib/marked.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v9.1.
|
|
2
|
+
* marked v9.1.6 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -751,7 +751,7 @@ class _Tokenizer {
|
|
|
751
751
|
const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
752
752
|
endReg.lastIndex = 0;
|
|
753
753
|
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
754
|
-
maskedSrc = maskedSrc.slice(-1 * src.length +
|
|
754
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
755
755
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
756
756
|
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
757
757
|
if (!rDelim)
|
|
@@ -772,7 +772,9 @@ class _Tokenizer {
|
|
|
772
772
|
continue; // Haven't found enough closing delimiters
|
|
773
773
|
// Remove extra characters. *a*** -> *a*
|
|
774
774
|
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
775
|
-
|
|
775
|
+
// char length can be >1 for unicode characters;
|
|
776
|
+
const lastCharLength = [...match[0]][0].length;
|
|
777
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
776
778
|
// Create `em` if smallest delimiter has odd char count. *a***
|
|
777
779
|
if (Math.min(lLength, rLength) % 2) {
|
|
778
780
|
const text = raw.slice(1, -1);
|
|
@@ -2050,11 +2052,9 @@ class Marked {
|
|
|
2050
2052
|
parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
|
|
2051
2053
|
parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
|
|
2052
2054
|
Parser = _Parser;
|
|
2053
|
-
parser = _Parser.parse;
|
|
2054
2055
|
Renderer = _Renderer;
|
|
2055
2056
|
TextRenderer = _TextRenderer;
|
|
2056
2057
|
Lexer = _Lexer;
|
|
2057
|
-
lexer = _Lexer.lex;
|
|
2058
2058
|
Tokenizer = _Tokenizer;
|
|
2059
2059
|
Hooks = _Hooks;
|
|
2060
2060
|
constructor(...args) {
|
|
@@ -2251,6 +2251,12 @@ class Marked {
|
|
|
2251
2251
|
this.defaults = { ...this.defaults, ...opt };
|
|
2252
2252
|
return this;
|
|
2253
2253
|
}
|
|
2254
|
+
lexer(src, options) {
|
|
2255
|
+
return _Lexer.lex(src, options ?? this.defaults);
|
|
2256
|
+
}
|
|
2257
|
+
parser(tokens, options) {
|
|
2258
|
+
return _Parser.parse(tokens, options ?? this.defaults);
|
|
2259
|
+
}
|
|
2254
2260
|
#parseMarkdown(lexer, parser) {
|
|
2255
2261
|
return (src, options) => {
|
|
2256
2262
|
const origOpt = { ...options };
|