Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- In an answer's list, everything after an item's first line came back at the left margin: a code block under a numbered step, a table, a quote or a second paragraph inside an item, so in the returned markdown it was no longer part of the list (the steps after it started a new list), and a list nested under item 10 or later was indented three spaces where it needs four, so it was not nested. An item's later lines now sit under the item's text. Found 2026-10-29 comparing live answers with the page.
- Sends failed as "ChatGPT model menu did not open after clicking the selector" when the page ignored the press on the model selector. Measured 2026-10-29 on WSL with the machine under load (load average 10-19): a send that started from a conversation pressed the selector after the new chat loaded, the press reached it while it read closed, and nothing happened, so the consult was blocked; across five runs 9 of 23 sends failed this way, every one of them a send that started from a conversation. prodex now presses a selector that still reads closed once more after a second and a half (one that reads open is left alone, as a press would shut it). The same wait serves `prodex pro browser models` and setup's model listing. With the fix, 18 of 18 sends under the same load went through, 4 of them on the second press.
- Inline code that held a backtick came back as broken markdown. An answer showing the code ``a`b`` or ``echo `date` `` returned `` `a`b` `` and `` `echo `date` ` ``, which markdown reads as a different span followed by stray backticks. Inline code is now wrapped in a backtick run longer than any inside it, padded with a space where markdown needs one. Found 2026-10-29 comparing a live answer with the page.
- Tables in answers lost their column alignment: a column written `:---`, `:---:` or `---:` came back as `---`, so a right-aligned column of numbers returned left-aligned. ChatGPT's newer answer renderer marks the alignment on each cell (`data-d-align` start, center or end), and the separator row now carries it. Found 2026-10-29 comparing a live answer with the page.

## 0.40.47

Expand Down
12 changes: 10 additions & 2 deletions src/chatgpt-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,18 @@ export const CHATGPT_RENDERED_MESSAGE_TEXT_JS = `
};
const table = (node) => {
const cell = (value) => collapse(value).trim().split("|").join(String.fromCharCode(92) + "|");
const rows = findAll(node, (n) => tagOf(n) === "tr").map((row) => children(row).filter((c) => c.nodeType === 1).map((c) => cell(inline(c))));
const cellNodes = findAll(node, (n) => tagOf(n) === "tr").map((row) => children(row).filter((c) => c.nodeType === 1));
const rows = cellNodes.map((cells) => cells.map((c) => cell(inline(c))));
if (rows.length === 0) return "";
// The newer renderer marks a column written :---, :---: or ---: with
// data-d-align start, center or end on its cells, and a plain column
// with none (measured 2026-10-29); every column came back as ---.
const rule = (c) => {
const align = attr(c, "data-d-align");
return align === "start" ? ":---" : align === "center" ? ":---:" : align === "end" ? "---:" : "---";
};
const line = (cells) => "| " + cells.join(" | ") + " |";
return [line(rows[0]), line(rows[0].map(() => "---")), ...rows.slice(1).map(line)].join(NL);
return [line(rows[0]), line(cellNodes[0].map(rule)), ...rows.slice(1).map(line)].join(NL);
};
const list = (node, keep) => {
const ordered = tagOf(node) === "ol";
Expand Down
17 changes: 17 additions & 0 deletions tests/answer-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ describe("page-read answers as markdown", () => {
expect(render(root)).toBe("| fruit | color |\n| --- | --- |\n| apple | red |\n| a\\|b | green |");
});

it("keeps each column's alignment", () => {
// Measured 2026-10-29: the newer renderer marks a column written :---,
// :---: or ---: with data-d-align start, center or end on its cells, and
// a plain column with none. Every column came back as ---.
const cell = (tag: string, value: string, align?: string) =>
el(tag, { "data-d-component": "table-cell", ...(align ? { "data-d-align": align } : {}) }, [el("p", {}, [value])]);
const root = el("div", {}, [
el("table", {}, [
el("tbody", {}, [
el("tr", {}, [cell("th", "Plain"), cell("th", "Left", "start"), cell("th", "Center", "center"), cell("th", "Right", "end")]),
el("tr", {}, [cell("td", "a"), cell("td", "b", "start"), cell("td", "c", "center"), cell("td", "d", "end")])
])
])
]);
expect(render(root)).toBe("| Plain | Left | Center | Right |\n| --- | :--- | :---: | ---: |\n| a | b | c | d |");
});

it("spells out source pills: a web source as a link, a file source as a label", () => {
const web = el("span", { "data-chatgpt-copy-reference": "0" }, [el("a", { href: "https://blog.rust-lang.org/x/" }, ["blog.rust-lang.org"])]);
const file = el("span", { "data-chatgpt-copy-reference": "1" }, [el("button", { "aria-label": "cont-att" }, ["cont-att"])]);
Expand Down
Loading