Repository navigation
fix(tui): render ~~~ fences as code blocks - #7156
Merged
Merged
Conversation
The markdown renderer only knew backtick fences, so a block opened with ~~~ rendered as prose: a `# comment` line became a heading with a rule under it, indentation was dropped, and `*x*` turned italic. The rest of the codebase already treats ~~~ as a fence (memory import, the agent roster, the plan handoff title). The fence carry now records the character along with the length. A fence closes only on the same character and at least the opener's length, so a ``` line inside a ~~~ block is code, and the other way round. Backtick fences parse as before. The streaming thinking preview mirrors the parser's fence rule to find a safe cut, so it follows. Signed-off-by: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Hmbown
pushed a commit
that referenced
this pull request
Oct 31, 2026
…urfaces Changelog lines for #7147, #7146, #7156, #7157, #7158, #7152 and #7150, and credit for the contributors across CHANGELOG `### Contributors`, docs/CONTRIBUTORS.md and UNRELEASED_CONTRIBUTORS (adds @luochen211, whose #7150 and #7149 landed). #7149 is a dead-code chore and has no changelog line. Verified: `python3 scripts/check-contributor-credit.py` reports every contributor in the window credited on all three surfaces; `scripts/preflight.sh --check` passes; `sh scripts/sync-changelog.sh` regenerated crates/tui/CHANGELOG.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The markdown renderer only knows backtick fences, so a code block opened with
~~~renders as prose, although the rest of the codebase already treats~~~as a fence (memory import, the agent roster, the plan handoff title).~~~is a common way to wrap text that has backtick fences of its own, such as a README section. In prose, a# commentline becomes a heading with a rule under it, indentation is dropped, and*all*turns italic. At 80 columns, before:After:
The parser's fence carry now records the fence character along with its length. A fence closes only on the same character and at least the opener's length, so a backtick fence inside a
~~~block is code, and the other way round. Backtick fences parse as before.streaming_preview_tail_sourcein the thinking preview mirrors the parser's fence rule to pick a cut that isn't inside a code block (a review note on #6249 pointed out the two would drift if the parser learned tilde fences), so it gets the same change; without it, a cut could land inside a~~~block and the preview would render the rest of that block as prose.This touches the same lines as #7146 (the parser's carry and
push_parsed_line's signature). If that one lands first, I'll mergemainin and resolve it here.Issue
No-Issue: code blocks fenced with
~~~render as prose in the transcript; I searched and found no issue for itHow I tested it
mainat 36f058c in a pseudo-terminal at 80x50 with an empty HOME and a local mock OpenAI-compatible server replying with the message above; the rows above come from those runs. A second reply checked the edges:~~~bashand backtickbashblocks holdingecho "$HOME and $USER"both render as code with the$left alone, a four-backtick block keeps a~~~line inside it as code, a~~~~block is not closed by~~~, and~~struck~~text still renders struck through. Onmainthe~~~bashline shows as text and the~~~~block's- insidelines render as list items.cargo nextest run -p codewhale-tui -p codewhale-tui-kit --lib: 13623 of 13625 passed, with the 266 tests whose names matchmarkdown,fenceorthinkingamong them. The 2 failures (status_report_localizes_the_complete_japanese_surface,test_update_model_compaction_budget) also fail onmainat 36f058c without this change.cargo fmt --all -- --check,cargo clippy -p codewhale-tui -p codewhale-tui-kitwith CI's flags (also on 1.99),cargo check -p codewhale-tui -p codewhale-tui-kit --all-targets,cargo +1.89.0 check -p codewhale-tui -p codewhale-tui-kitandcargo doc -p codewhale-tui-kit --no-depswith-D warnings: clean.Checklist
maincargo fmt --allpasses, and tests cover new or changed behavior —cargo fmtpasses; no new test, per AGENTS.md, so the runs above stand in for onedocs/features.toml(cargo test -p codewhale-tui --test feature_registrychecks it) — n/a