Repository navigation
fix: preserve Markdown formatting in HTML export lists - #140830
Conversation
HTML session exports now preserve bold text, links, and inline code in list items for user and assistant messages. Delegate composite Marked text tokens through the existing renderer while retaining leaf escaping and child hooks. Fixes #140785.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 1:25 AM ET / 05:25 UTC. ClawSweeper reviewWhat this changesHTML session exports preserve bold text, links, and inline code inside list items, with regression coverage for user and assistant messages and updated command documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main retains the reported defect, and the proposed repair follows Marked’s supported renderer contract. No actionable correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherThe session export command combines transcript records with a bundled HTML viewer. That viewer renders message Markdown through Marked and OpenClaw’s escaping and URL-safety hooks. flowchart LR
A[Session transcript] --> B[Export command]
B --> C[Standalone HTML file]
C --> D[Markdown renderer]
D --> E{Nested inline tokens?}
E -->|Yes| F[Existing formatting and safety hooks]
E -->|No| G[Escaped text]
F --> H[Rendered conversation]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +60, Docs +3. Total +63 across 3 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use Marked’s existing nested-token traversal while preserving OpenClaw’s leaf escaping and child safety hooks. Do we have a high-confidence way to reproduce the issue? Yes: exporting a tight list containing bold text, a link, and inline code exercises the faulty current-main hook; the linked report supplies a real Gateway/TUI reproduction. This review verified the source mechanism without executing it. Is this the best way to solve the issue? Yes: delegating composite tokens through Marked’s supported fallback is a narrow repair that reuses the existing parser and safety hooks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4ac1bcb9a94. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
HTML session exports now preserve bold text, links, and inline code in list items for user and assistant messages. Delegate composite Marked text tokens through the existing renderer while retaining leaf escaping and child hooks. Fixes openclaw#140785.
Closes #140785.
What Problem This Solves
Fixes an issue where users exporting a session to HTML would see literal Markdown inside tight lists, even though the same bold text, link, and inline code rendered correctly in a paragraph.
Why This Change Was Made
The shared export renderer treated composite Marked text tokens as leaves. It now delegates tokens with inline children through Marked 18.0.11's existing renderer contract. Leaf escaping and the code, raw-HTML, image, link, and URL-validation hooks keep their existing implementations. This restores the canonical traversal without adding a parser, dependency, configuration option, or stored state.
Production: +2/-2, net zero. Tests: +60. Docs: +3.
User Impact
/export-sessionand/exportpreserve bold text, authored links, and inline code in list items for both user and assistant messages. Markdown inside literal inline code stays literal.Evidence
pnpm buildpassed in 624.6 seconds. Full source inventories matched before/after; the generated export template equals the repaired source./export tight-list-proof.html→ actual HTML in Chromium passed before and after. Both runs received the persisted export acknowledgement, exported one entry, preserved paragraph/plain-list/literal-code controls, and completed TUI/browser/session/Gateway cleanup without forced termination. Source, dependencies, and complete build inventories verified before and after each run. Screenshots and recordings were inspected.Validation ran against the final working diff, which matches committed
d3ff01fd12d446b63c57a0cd30ca6eda1bb7dd1dbyte-for-byte. The live case is an injected assistant export, not a model inference run; both roles are covered by the source regression. The leaf-only hook is also present inv2026.9.2source; its introducing commit is not attributed. Exact-head CI passed: 77 jobs succeeded and 16 inapplicable jobs were skipped.Before — list syntax remains literal:
After — list formatting matches the paragraph:
Proof harness recovery
Earlier attempts are retained as failed evidence: one stopped at a Git preflight timeout; another completed the export but exceeded teardown while its observer repeatedly spawned per-PID process queries. The accepted runs use a single-inventory observer with fresh identity checks before signals and unchanged product assertions and shutdown limits. Both accepted runs exited normally with no survivors or open listener.