Skip to content

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

Handle whitespace-only Markdown list items

Emre Sokullu714d8bd31bef
diff --git a/src/chrome/src/ui/markdown-render.js b/src/chrome/src/ui/markdown-render.js
index 2682f2b83..783a006c3 100644
--- a/src/chrome/src/ui/markdown-render.js
+++ b/src/chrome/src/ui/markdown-render.js
@@ -327,9 +327,15 @@ function listContinuationContainer(source, position, prefix, indentation, noList
if (missingQuotes < 0 || (missingQuotes && !current.leadingQuoteIndent)) return noList();
if (precedingContainer.listPrefix) {
- const container = missingQuotes
+ let container = missingQuotes
? fenceContainer(`${precedingContainer.containerPrefix}${'> '.repeat(missingQuotes)}`)
: precedingContainer;
+ const emptyListMarker = line.match(/^[ \t]*(?:[-+*]|\d{1,9}[.)])[ \t]*$/);
+ if (emptyListMarker) {
+ const marker = emptyListMarker[0].replace(/[ \t]+$/, '');
+ container = { ...container, listIndentGroups: [...container.listIndentGroups] };
+ container.listIndentGroups[container.listIndentGroups.length - 1] = indentationColumns(marker) + 1;
+ }
const listIndent = container.listIndentGroups.at(-1);
if (listIndent && continuationIndent >= listIndent && continuationIndent <= listIndent + 3) {
return container;
diff --git a/src/firefox/src/ui/markdown-render.js b/src/firefox/src/ui/markdown-render.js
index 2682f2b83..783a006c3 100644
--- a/src/firefox/src/ui/markdown-render.js
+++ b/src/firefox/src/ui/markdown-render.js
@@ -327,9 +327,15 @@ function listContinuationContainer(source, position, prefix, indentation, noList
if (missingQuotes < 0 || (missingQuotes && !current.leadingQuoteIndent)) return noList();
if (precedingContainer.listPrefix) {
- const container = missingQuotes
+ let container = missingQuotes
? fenceContainer(`${precedingContainer.containerPrefix}${'> '.repeat(missingQuotes)}`)
: precedingContainer;
+ const emptyListMarker = line.match(/^[ \t]*(?:[-+*]|\d{1,9}[.)])[ \t]*$/);
+ if (emptyListMarker) {
+ const marker = emptyListMarker[0].replace(/[ \t]+$/, '');
+ container = { ...container, listIndentGroups: [...container.listIndentGroups] };
+ container.listIndentGroups[container.listIndentGroups.length - 1] = indentationColumns(marker) + 1;
+ }
const listIndent = container.listIndentGroups.at(-1);
if (listIndent && continuationIndent >= listIndent && continuationIndent <= listIndent + 3) {
return container;