Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9d626b0
Fix nested Markdown code fence rendering
esokullu Sep 22, 2026
24e34bc
Potential fix for pull request finding 'CodeQL / Bad HTML filtering r…
esokullu Sep 22, 2026
24c8e36
Preserve Markdown fence containers
esokullu Sep 22, 2026
a8218c6
Harden Markdown fence container handling
esokullu Sep 22, 2026
03b0957
Handle variable fence container indentation
esokullu Sep 22, 2026
1f77f5a
Reject over-indented list fence closers
esokullu Sep 22, 2026
60dce91
Handle tab-indented list code fences
esokullu Sep 22, 2026
63a7813
Separate history fence info strings
esokullu Sep 22, 2026
4f3ff94
Keep unmatched nested fences from consuming prose
esokullu Sep 22, 2026
c92a21d
Distinguish streamed and completed nested fences
esokullu Sep 22, 2026
bf23a04
Bound nested fence lookahead
esokullu Sep 22, 2026
4020be8
Support continuation list code fences
esokullu Sep 22, 2026
ebb0f9e
Retain list context for indented fences
esokullu Sep 22, 2026
eb5accb
End unfinished fences at container boundaries
esokullu Sep 22, 2026
8e994c5
Use streaming state for nested Markdown fences
esokullu Sep 22, 2026
4dd8fea
Preserve fenced blocks across final renders
esokullu Sep 22, 2026
35afdae
Reprocess fences after container boundaries
esokullu Sep 22, 2026
8481ffb
Parse nested Markdown fence containers
esokullu Sep 22, 2026
1c1210a
Avoid backtracking in fence container parsing
esokullu Sep 22, 2026
698a4db
Cache Markdown fence container boundaries
esokullu Sep 22, 2026
03aab73
Preserve quoted fence boundaries
esokullu Sep 22, 2026
b98b067
Track Markdown fence container indentation
esokullu Sep 22, 2026
798f8d4
Avoid copying Markdown fence prefixes
esokullu Sep 22, 2026
94a885c
Handle Markdown fence container whitespace
esokullu Sep 22, 2026
87c0dbc
Scan Markdown fence blank lines once
esokullu Sep 22, 2026
245b2db
Find indented Markdown fence continuations
esokullu Sep 22, 2026
ffad5db
Preserve longer nested Markdown fences
esokullu Sep 22, 2026
b40b007
Support wide list quote fences
esokullu Sep 22, 2026
b242258
Preserve Markdown fence boundary newlines
esokullu Sep 22, 2026
5960479
Strip Markdown fence indentation from code
esokullu Sep 22, 2026
20bdb68
Preserve list fences in Markdown wrappers
esokullu Sep 22, 2026
6fefdf5
Cache list-free Markdown fence regions
esokullu Sep 22, 2026
0094065
Validate nested Markdown fence indentation
esokullu Sep 22, 2026
bb1836c
Bound alternate Markdown fence nesting
esokullu Sep 22, 2026
ee9b990
Scan complete alternate Markdown fences
esokullu Sep 22, 2026
7117538
Index nested Markdown fence closers
esokullu Sep 22, 2026
c3f02e3
Validate nested Markdown fence closures
esokullu Sep 22, 2026
70f9b1d
Handle nested tabbed list fences
esokullu Sep 22, 2026
736b409
Align Markdown fences in quoted tabs
esokullu Sep 22, 2026
b5a2824
Limit Markdown fence recovery to streams
esokullu Sep 22, 2026
80d11f9
Parse nested Markdown list containers
esokullu Sep 22, 2026
6aea83b
Preserve indented Markdown list snippets
esokullu Sep 22, 2026
dd12fd9
Honor visual Markdown list padding
esokullu Sep 22, 2026
314a112
Handle empty Markdown list fence containers
esokullu Sep 22, 2026
a87402c
Respect nested Markdown container indentation
esokullu Sep 22, 2026
acf4928
Preserve streamed alternate Markdown fences
esokullu Sep 22, 2026
5f64a66
Honor implicit Markdown list padding
esokullu Sep 22, 2026
608f236
End Markdown quotes at blank boundaries
esokullu Sep 22, 2026
005af44
Respect mixed Markdown quote boundaries
esokullu Sep 22, 2026
08f90ee
Preserve Markdown quote continuation prefixes
esokullu Sep 22, 2026
88f796c
Limit Markdown ordered list markers
esokullu Sep 22, 2026
714d8bd
Handle whitespace-only Markdown list items
esokullu Sep 22, 2026
5c7fe01
Preserve tabbed Markdown list padding
esokullu Sep 22, 2026
c77a198
Track Markdown list continuation columns
esokullu Sep 22, 2026
19c142d
Detect nested empty Markdown list items
esokullu Sep 22, 2026
007bcd6
Track innermost Markdown list padding
esokullu Sep 22, 2026
cb6d845
Retain nested Markdown list indentation
esokullu Sep 22, 2026
e002b12
Avoid duplicate Markdown list padding
esokullu Sep 22, 2026
a224ab5
Cache Markdown list continuations
esokullu Sep 22, 2026
1d886d3
Scope cached Markdown list continuations
esokullu Sep 22, 2026
589e3db
Scan lazy Markdown list continuations
esokullu Sep 22, 2026
6711233
Bound lazy Markdown list scans
esokullu Sep 22, 2026
baa234d
Respect lazy ordered Markdown continuations
esokullu Sep 22, 2026
7e74253
Handle empty ordered markers and thematic lines
esokullu Sep 22, 2026
ab3ac29
Scan quoted Markdown list continuations
esokullu Sep 22, 2026
5af372b
Reprocess fences after Markdown container boundaries
esokullu Sep 22, 2026
7c4f546
Keep trailing blank outside quoted Markdown fences
esokullu Sep 22, 2026
ea149d4
Preserve nested Markdown fences in final assistant renders
esokullu Sep 22, 2026
49cb262
Stop Markdown list scans at HTML blocks
esokullu Sep 22, 2026
b554eaa
Preserve list continuation after empty bullet markers
esokullu Sep 22, 2026
fd5c6eb
Merge pull request #364 from esokullu/codex/fix-markdown-code-fences
esokullu Sep 22, 2026
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"private": true,
"type": "module",
"scripts": {
"test": "npm run test:systemone && npm run test:systemone:fast && node --test test/browser-dialogs.mjs && npm run test:firefox-bidi && npm run test:runtime-lifecycle && npm run test:provider-limits && npm run test:accessibility-tree-benchmark && npm run test:toolbar-guard && npm run test:pdf-read && npm run test:pdf-selection && npm run test:social-contract && npm run test:safesocial && npm run test:build-unpacked && npm run test:attachment-drop && node test/run.js && node test/selection-scope-restoration.mjs && node scripts/benchmark-offline-relevance.mjs && npm run test:security",
"test": "npm run test:markdown && npm run test:systemone && npm run test:systemone:fast && node --test test/browser-dialogs.mjs && npm run test:firefox-bidi && npm run test:runtime-lifecycle && npm run test:provider-limits && npm run test:accessibility-tree-benchmark && npm run test:toolbar-guard && npm run test:pdf-read && npm run test:pdf-selection && npm run test:social-contract && npm run test:safesocial && npm run test:build-unpacked && npm run test:attachment-drop && node test/run.js && node test/selection-scope-restoration.mjs && node scripts/benchmark-offline-relevance.mjs && npm run test:security",
"test:provider-limits": "node test/provider-model-limits.mjs",
"test:markdown": "node --test test/markdown-render.mjs",
"test:accessibility-tree-benchmark": "node --test test/llm/lib/accessibility-tree-formats.test.mjs && node test/llm/accessibility-tree-benchmark.mjs --no-exact-tokenizer --check",
"test:attachment-drop": "node test/attachment-drop.mjs",
"test:security": "node test/security/injection-corpus.mjs",
Expand Down
17 changes: 15 additions & 2 deletions src/chrome/src/ui/history-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,23 @@ export function historyTextFromElement(root, { markdown = true } = {}) {
if (markdown && tagName === 'PRE') {
const language = String(node.parentElement?.querySelector?.('.code-lang')?.textContent || '').trim();
ensureBreak();
output += `\`\`\`${language}\n`;
const beforeCode = output;
output = '';
for (const child of Array.from(node.childNodes || [])) visit(child, false, true);
ensureBreak();
output += '```';
const code = output;
// History must not reintroduce ambiguous fences around a Markdown
// document (or any code sample containing literal backtick runs).
const fenceCharacter = language.includes('`') ? '~' : '`';
let fenceLength = 3;
for (const match of code.matchAll(new RegExp(`${fenceCharacter}{3,}`, 'g'))) {
fenceLength = Math.max(fenceLength, match[0].length + 1);
}
const fence = fenceCharacter.repeat(fenceLength);
// Keep an info string separate from the fence so a label beginning with
// the same marker cannot extend the opener past its matching closer.
const info = language ? ` ${language}` : '';
output = `${beforeCode}${fence}${info}\n${code}${fence}`;
return;
}
if (markdown && tagName === 'CODE' && !inPre) {
Expand Down
Loading
Loading