diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e4e5c..40200b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `[](url (xxx())` is no longer a valid link. - `[](url\ xxx)` is no longer a valid link. - Fix performance issues when parsing links, #732, #734. -- Fix performance issues when parsing backticks, #733. +- Fix performance issues when parsing backticks, #733, #736. - Fix performance issues when parsing emphases, #735. diff --git a/lib/rules_inline/backticks.js b/lib/rules_inline/backticks.js index f7c3d1d..b9c9ddb 100644 --- a/lib/rules_inline/backticks.js +++ b/lib/rules_inline/backticks.js @@ -52,13 +52,11 @@ module.exports = function backtick(state, silent) { // Some different length found, put it in cache as upper limit of where closer can be found state.backticks[closerLength] = matchStart; - - // Scanned through the end, didn't find anything - if (matchEnd >= max) { - state.backticksScanned = true; - } } + // Scanned through the end, didn't find anything + state.backticksScanned = true; + if (!silent) state.pending += marker; state.pos += openerLength; return true; diff --git a/test/pathological.js b/test/pathological.js index a905dc5..fbbffdd 100644 --- a/test/pathological.js +++ b/test/pathological.js @@ -122,5 +122,9 @@ describe('Pathological sequences speed', () => { it('emphasis **_* pattern', async () => { await test_pattern('**_* '.repeat(50000)); }); + + it('backtick ``\\``\\`` pattern', async () => { + await test_pattern('``\\'.repeat(50000)); + }); }); });