Skip to content

Commit 7b3036f

Browse files
author
MarkedJS bot
committed
🗜️ build [skip ci]
1 parent ced3ff1 commit 7b3036f

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

lib/marked.esm.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,20 +2196,22 @@ function marked(src, opt, callback) {
21962196
marked.walkTokens(tokens, function(token) {
21972197
if (token.type === 'code') {
21982198
pending++;
2199-
highlight(token.text, token.lang, function(err, code) {
2200-
if (err) {
2201-
return done(err);
2202-
}
2203-
if (code != null && code !== token.text) {
2204-
token.text = code;
2205-
token.escaped = true;
2206-
}
2199+
setTimeout(() => {
2200+
highlight(token.text, token.lang, function(err, code) {
2201+
if (err) {
2202+
return done(err);
2203+
}
2204+
if (code != null && code !== token.text) {
2205+
token.text = code;
2206+
token.escaped = true;
2207+
}
22072208

2208-
pending--;
2209-
if (pending === 0) {
2210-
done();
2211-
}
2212-
});
2209+
pending--;
2210+
if (pending === 0) {
2211+
done();
2212+
}
2213+
});
2214+
}, 0);
22132215
}
22142216
});
22152217

lib/marked.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,22 +2291,24 @@
22912291
marked.walkTokens(tokens, function (token) {
22922292
if (token.type === 'code') {
22932293
pending++;
2294-
highlight(token.text, token.lang, function (err, code) {
2295-
if (err) {
2296-
return done(err);
2297-
}
2294+
setTimeout(function () {
2295+
highlight(token.text, token.lang, function (err, code) {
2296+
if (err) {
2297+
return done(err);
2298+
}
22982299

2299-
if (code != null && code !== token.text) {
2300-
token.text = code;
2301-
token.escaped = true;
2302-
}
2300+
if (code != null && code !== token.text) {
2301+
token.text = code;
2302+
token.escaped = true;
2303+
}
23032304

2304-
pending--;
2305+
pending--;
23052306

2306-
if (pending === 0) {
2307-
done();
2308-
}
2309-
});
2307+
if (pending === 0) {
2308+
done();
2309+
}
2310+
});
2311+
}, 0);
23102312
}
23112313
});
23122314

0 commit comments

Comments
 (0)