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 @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Answers lost their horizontal rules. ChatGPT's newer answer renderer draws a `---` rule as an empty `div[data-d-component=divider]`, and prodex read only `<hr>`, so an answer showing a rule between two sections came back with the sections run together. The rule now comes back as `---`. Found 2026-10-29 comparing a live answer with the page.
- 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.

## 0.40.47

Expand Down
13 changes: 12 additions & 1 deletion src/chatgpt-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,17 @@ export const CHATGPT_RENDERED_MESSAGE_TEXT_JS = `
const link = findAll(node, (n) => tagOf(n) === "a" && (attr(n, "href") || "").startsWith("http"))[0];
return link ? "[" + label + "](" + untracked(attr(link, "href")) + ")" : "[" + label + "]";
};
// Inline code goes in a backtick run longer than any inside it, padded
// with a space when it starts or ends with a backtick, or has a space at
// both ends that markdown would strip. One backtick each side turned the
// code a\`b into a one-letter span and a stray backtick (measured
// 2026-10-29).
const inlineCode = (value) => {
const longestRun = (value.match(new RegExp(BT + "+", "g")) || []).reduce((most, run) => Math.max(most, run.length), 0);
const ticks = BT.repeat(longestRun + 1);
const pad = value.startsWith(BT) || value.endsWith(BT) || (value.startsWith(" ") && value.endsWith(" ") && value.trim() !== "") ? " " : "";
return ticks + pad + value + pad + ticks;
};
const inline = (node, keep) => {
const keepLines = keepsLineBreaks(node, keep === true);
let out = "";
Expand All @@ -572,7 +583,7 @@ export const CHATGPT_RENDERED_MESSAGE_TEXT_JS = `
if (isCheckbox(node)) return (attr(node, "aria-checked") === "true" || attr(node, "checked") !== null ? "[x]" : "[ ]") + " ";
if (isMath(node)) return isDisplayMath(node) ? "$$" + mathSource(node) + "$$" : "$" + mathSource(node) + "$";
if (attr(node, "data-chatgpt-copy-reference") !== null || isSourceBadge(node)) return pill(node);
if (attr(node, "data-markdown-copy") === "inline-code" || tag === "code") return BT + (node.textContent || "") + BT;
if (attr(node, "data-markdown-copy") === "inline-code" || tag === "code") return inlineCode(node.textContent || "");
if (tag === "br") return NL;
const inner = inline(node, keep);
// The newer renderer marks bold as span[data-d-default-strong], italic
Expand Down
22 changes: 22 additions & 0 deletions tests/answer-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,28 @@ describe("line breaks the page shows", () => {
// span[data-d-text-decoration=line-through], as it marks bold with
// data-d-default-strong. Only bold was read, so "*better*" and "~~old~~" came
// back as plain words and "***brilliant***" as "**brilliant**".
describe("inline code holding backticks", () => {
// Measured 2026-10-29: the page showed the code ``a`b`` and ``echo `date` ``,
// and the answer came back as `a`b` and `echo `date` `, which markdown reads
// as different spans with stray backticks between them.
const code = (value: string) => el("code", { "data-d-component": "code" }, [value]);

it("wraps it in a longer backtick run", () => {
const root = el("div", {}, [el("p", {}, ["Run ", code("echo `date` "), " or ", code("a`b"), "."])]);
expect(render(root)).toBe("Run ``echo `date` `` or ``a`b``.");
});

it("pads code that starts or ends with a backtick, or with spaces on both sides", () => {
const root = el("div", {}, [el("p", {}, ["A lone ", code("`"), ", ", code("``x"), " and ", code(" x "), "."])]);
expect(render(root)).toBe("A lone `` ` ``, ``` ``x ``` and ` x `.");
});

it("leaves plain inline code as it was", () => {
const root = el("div", {}, [el("p", {}, ["Call ", code("add(2, 3)"), "."])]);
expect(render(root)).toBe("Call `add(2, 3)`.");
});
});

describe("emphasis in the newer renderer", () => {
const text = (attrs: Record<string, string>, value: string) => el("span", { "data-d-component": "text", ...attrs }, [value]);

Expand Down
Loading