fix: keep shell fences rendered as code blocks - #58023
Conversation
Related: #49972 (keep plain-text fences copyable) and #57540 (Desktop leaks explicit |
|
This looks related to the explicit plain-text fence leak tracked in #57540 / #49972, but it also covers shell-fence aliases and Markdown-math side effects. A useful consolidation criterion would be: explicit |
|
Thanks @Kinkoolino-Hermes for linking the related work. My intent with this PR is the narrower scoped shell-command case:
I agree this overlaps with #49972 / #57540 around explicit |
|
Thanks for targeting the shell-fence misclassification. The current-main premise is real: Problems
Suggested changes
Automated hermes-sweeper review. |
|
thanks @teknium1, this has been addressed in the latest push. Changes:
Verified:
RE the overlapping PRs: #49972 is the earliest plain-text fence PR and #57542 directly targets #57540. I’m happy for you to pick whichever consolidation target is best; this PR now covers the shell-fence regression plus the explicit plain-text fence contract, and I can transfer the shell-specific coverage if another PR becomes the merge target. |
|
hey @OutThisLife, thank you for your note on #64721 . RE splitting out the unrelated markdown shell-fence change - this PR is the standalone version of that change. It keeps shell-like fenced blocks on the code path, including common aliases like Happy to adjust the scope if you’d prefer this PR to stay shell-only and leave the plain-text fence contract to #49972 / #57540. LMK what you think 😄 |
# Conflicts: # apps/desktop/src/lib/markdown-code.test.ts # apps/desktop/src/lib/markdown-code.ts
|
Hi @alt-glitch, bumping this for your review. It preserves explicit |
Context
Hermes Desktop can demote fenced snippets into prose when they look text-like. That breaks two related cases:
text,plain, orplaintextfences can leak the language tag into rendered prose and lose the copyable code-card treatment ([Bug]: Desktop leaks explicit text fence language into rendered prose #57540 / fix(desktop): keep plain-text fences copyable #49972)$HOME/$USERhit Markdown or math renderingSolution
text,plain, andplaintextfences as code by author intent in both preprocessing and render-time classification.zsh,fish,powershell,cmd, etc.) on the code path.Verification
npm exec vitest run src/lib/markdown-code.test.ts src/components/assistant-ui/markdown-text.test.ts -- --environment nodenpx eslint src/lib/markdown-code.ts src/lib/markdown-code.test.ts src/components/assistant-ui/markdown-text.test.tsnpm run typecheckgit diff --checkScreenshots
Before:
After: