From 04a18968115b47f8eb7bbb64b3c7edabe93e817b Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Sun, 25 Oct 2020 23:26:55 -0400 Subject: [PATCH] fix: revert refactor in markdown-kroki and plantuml modules (#2619) --- server/modules/rendering/markdown-kroki/renderer.js | 9 +++++++-- server/modules/rendering/markdown-plantuml/renderer.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/server/modules/rendering/markdown-kroki/renderer.js b/server/modules/rendering/markdown-kroki/renderer.js index 1487f737..801bab6d 100644 --- a/server/modules/rendering/markdown-kroki/renderer.js +++ b/server/modules/rendering/markdown-kroki/renderer.js @@ -73,8 +73,13 @@ module.exports = { continue } - const i = closeMarker.findIndex(item => item !== state.src[start + i]) - const closeMarkerMatched = i !== -1 + let closeMarkerMatched = true + for (i = 0; i < closeMarker.length; ++i) { + if (closeMarker[i] !== state.src[start + i]) { + closeMarkerMatched = false + break + } + } if (!closeMarkerMatched) { continue diff --git a/server/modules/rendering/markdown-plantuml/renderer.js b/server/modules/rendering/markdown-plantuml/renderer.js index 0ad67e9e..40eedc04 100644 --- a/server/modules/rendering/markdown-plantuml/renderer.js +++ b/server/modules/rendering/markdown-plantuml/renderer.js @@ -74,8 +74,13 @@ module.exports = { continue } - const i = closeMarker.findIndex(item => item !== state.src[start + i]) - const closeMarkerMatched = i !== -1 + let closeMarkerMatched = true + for (i = 0; i < closeMarker.length; ++i) { + if (closeMarker[i] !== state.src[start + i]) { + closeMarkerMatched = false + break + } + } if (!closeMarkerMatched) { continue