Skip to content

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

Respect mixed Markdown quote boundaries

Emre Sokullu005af442194f
diff --git a/src/chrome/src/ui/markdown-render.js b/src/chrome/src/ui/markdown-render.js
index f3fee85ae..47f8c8cf8 100644
--- a/src/chrome/src/ui/markdown-render.js
+++ b/src/chrome/src/ui/markdown-render.js
@@ -394,7 +394,7 @@ function unfinishedContainerEnd(source, start, container, boundaryCache) {
end = pendingBlankStart ?? offset;
break;
}
- if (pendingBlankStart != null && container.quoteDepth && !container.listPrefix) {
+ if (pendingBlankStart != null && container.quoteDepth) {
end = pendingBlankStart;
break;
}
diff --git a/src/firefox/src/ui/markdown-render.js b/src/firefox/src/ui/markdown-render.js
index f3fee85ae..47f8c8cf8 100644
--- a/src/firefox/src/ui/markdown-render.js
+++ b/src/firefox/src/ui/markdown-render.js
@@ -394,7 +394,7 @@ function unfinishedContainerEnd(source, start, container, boundaryCache) {
end = pendingBlankStart ?? offset;
break;
}
- if (pendingBlankStart != null && container.quoteDepth && !container.listPrefix) {
+ if (pendingBlankStart != null && container.quoteDepth) {
end = pendingBlankStart;
break;
}
diff --git a/test/markdown-render.mjs b/test/markdown-render.mjs
index 935b33b9d..e9b5ce69f 100644
--- a/test/markdown-render.mjs
+++ b/test/markdown-render.mjs
@@ -405,6 +405,14 @@ for (const build of ['chrome', 'firefox']) {
}), '> BLOCK\n> second\n> ```\nAfter');
assert.deepEqual(unprefixedQuoteBlocks, [{ info: 'text', code: 'first\n' }]);
+ const mixedQuoteListBreak = '> - ```text\n> first\n\n> second\n> ```\nAfter';
+ const mixedQuoteListBlocks = [];
+ assert.equal(helpers.replaceMarkdownCodeFences(mixedQuoteListBreak, (info, code) => {
+ mixedQuoteListBlocks.push({ info, code });
+ return 'BLOCK';
+ }), '> - BLOCK\n> second\n> ```\nAfter');
+ assert.deepEqual(mixedQuoteListBlocks, [{ info: 'text', code: 'first\n' }]);
+
const wideQuotedListBlank = '10. > ```text\n > hello\n >\n > again\n > ```';
const wideQuotedListBlocks = [];
assert.equal(helpers.replaceMarkdownCodeFences(wideQuotedListBlank, (info, code) => {