Skip to content

User message content should be truncatable for long content (e.g. PDFs) #33

@banifou

Description

@banifou

Hi @simonw,

Thanks for this great tool! Actually, almost all of my code is generated by Claude these days. During my exchanges with Claude, relevant information often emerges that is very important for the projects. Until now, I had to laboriously copy and paste it into Markdown files. This tool is a huge help.
It would be great if the tool could automatically generate a transcript of the session right before auto-compacting starts. I’m often caught off guard by the auto-compacting while I’m right in the middle of working!
See: anthropics/claude-code#15923

Bug Description

The user_content macro in macros.html doesn't wrap content in a truncatable div, unlike other content types like tool_result, tool_use, write_tool, edit_tool, and bash_tool.

This causes long user messages (e.g., when a PDF document is included in the conversation) to display in full, making the page very long and hard to navigate.

Steps to Reproduce

  1. Convert a session that contains a long user message (e.g., a PDF document)
  2. The user message div has no "Show more" button and displays the entire content

Expected Behavior

Long user messages should be collapsed by default with a "Show more" button, consistent with how tool results and other content types behave.

Proposed Fix

In src/claude_code_transcripts/templates/macros.html, change the user_content macro from:

{% macro user_content(content_html) %}
<div class="user-content">{{ content_html|safe }}</div>
{%- endmacro %}

to:

{% macro user_content(content_html) %}
 <div class="user-content"><div class="truncatable"><div class="truncatable-content">{{ content_html|safe }}</div><button class="expand-btn">Show more</button></div></div>
 {%- endmacro %}

This matches the pattern used by tool_result and other macros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions