Code-fenced directory trees in Markdown cause rendering and copy issues

Category
Bug Report

Environment

  • OS: Ubuntu 25.10 (Questing Quokka)

  • Browser: Mozilla Firefox 145.0.2

  • Site: https://t3.chat

Disclosure
This report was formulated by an AI assistant (GPT-5) on my request.
https://t3.chat/chat/7e77b4e8-57fb-4af4-9175-9270d443a5fe

Steps to reproduce

  1. Start a new chat on t3.chat.

  2. Send a Markdown README inside a single fenced code block, for example using ```markdown as the fence.

  3. Include a “Package structure” section that looks like an ASCII directory tree with inline comments (file names on the left, comments on the right). Example content to put inside the fence:
    mapgen/
    init.py # package marker
    constants.py # styles and tunables
    geo_io.py # projection/clip/path helpers + YAML/raster + SVG DOM
    core_render.py # canvas/bbox sizing + map/grid/markers
    scenes.py # scene discovery + mask/crop + export
    pipeline.py # orchestrator
    cli.py # argparse wrapper

  4. Send the message.

Expected behavior

  • The message renders as a normal code block.

  • The entire content stays intact and is copyable verbatim (no truncation, no reflow, no dropped lines).

Actual behavior

  • The UI appears to get confused by the code-fenced ASCII tree:

    • Portions of the block are truncated or not displayed.

    • Copy/paste yields incomplete or modified text (spacing/lines changed).

    • Reposting similar blocks sometimes fails again, inconsistently.

  • When the same README is reformatted (no ASCII tree, just bullet points), it works reliably.

Impact

  • Makes it hard to share READMEs or snippets that include directory trees.

  • Forces users to avoid common documentation patterns or use workarounds (base64, bullets, multiple small blocks).

Workarounds observed

  • Replace the tree with a bullet list of files and descriptions.

  • Split content into smaller fenced blocks.

  • Encode the content as base64 and share that instead.

Notes

  • The issue seems triggered by a code-fenced block that resembles shell tree output with inline comments.

  • It may be an overzealous heuristic that tries to re-interpret or sanitize tree-like code within fenced blocks.

Proposed fixes

  • Treat all fenced code blocks as inert text (no tree/CLI heuristics inside fences).

  • Provide a “Copy raw” button that copies the exact underlying text.

  • If sanitization is required, avoid applying it to fenced code blocks.

Attachments

  • I can provide a screenshot showing the composition UI and the problematic section upon request.

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🐛

Bug Reports

Subscribe to post

Get notified by email when there are changes.