Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Bound lazy Markdown list scans

Emre Sokullu67112335f0ba
diff --git a/src/chrome/src/ui/markdown-render.js b/src/chrome/src/ui/markdown-render.js
index ddace93cc..e35d991ee 100644
--- a/src/chrome/src/ui/markdown-render.js
+++ b/src/chrome/src/ui/markdown-render.js
@@ -373,7 +373,9 @@ function listContinuationContainer(source, position, prefix, indentation, noList
// A fenced continuation may be up to three columns deeper than ordinary
// list content, so continue back to the enclosing list marker first.
if (lineIndent < 2) {
- if (!quotePrefix && !lineIndent && !current.quoteDepth) {
+ const lazyParagraph = !quotePrefix && !lineIndent && !current.quoteDepth
+ && !/^(?:#{1,6}(?:\s|$)|(?:[-+*]|\d+[.)])\s+|>|`{3,}|~{3,}|(?:[-*_]\s*){3,})/.test(content);
+ if (lazyParagraph) {
if (!lineStart) break;
lineEnd = lineStart - 1;
if (source[lineEnd] === '\n') lineEnd -= 1;
diff --git a/src/firefox/src/ui/markdown-render.js b/src/firefox/src/ui/markdown-render.js
index ddace93cc..e35d991ee 100644
--- a/src/firefox/src/ui/markdown-render.js
+++ b/src/firefox/src/ui/markdown-render.js
@@ -373,7 +373,9 @@ function listContinuationContainer(source, position, prefix, indentation, noList
// A fenced continuation may be up to three columns deeper than ordinary
// list content, so continue back to the enclosing list marker first.
if (lineIndent < 2) {
- if (!quotePrefix && !lineIndent && !current.quoteDepth) {
+ const lazyParagraph = !quotePrefix && !lineIndent && !current.quoteDepth
+ && !/^(?:#{1,6}(?:\s|$)|(?:[-+*]|\d+[.)])\s+|>|`{3,}|~{3,}|(?:[-*_]\s*){3,})/.test(content);
+ if (lazyParagraph) {
if (!lineStart) break;
lineEnd = lineStart - 1;
if (source[lineEnd] === '\n') lineEnd -= 1;