From fbbb0a126da80a845195dcd90b4988aebdc6e512 Mon Sep 17 00:00:00 2001 From: Christian Boos Date: Sun, 30 Nov 2025 19:57:44 +0100 Subject: [PATCH 1/6] Extract inline CSS styles to stylesheet classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes inline style attributes from HTML templates and Python renderer code, extracting them into appropriate CSS files for better maintainability and consistency. Changes: - transcript.html: Removed inline styles from session-subtitle - index.html: Removed inline styles from summary-stats-flex and transcript-link-hint - session_nav.html: Removed inline styles from nav-hint and session-preview - renderer.py: Replaced inline image styles with CSS classes (tool-result-image, uploaded-image) - message_styles.css: Added session-subtitle and image styling classes - global_styles.css: Added summary-stats-flex class - project_card_styles.css: Added transcript-link-hint class - session_nav_styles.css: Added nav-hint and session-preview classes Skipped dynamic styles: - timeline.html JavaScript styles (runtime-manipulated) - ANSI color conversion in renderer.py (runtime-computed values) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- claude_code_log/renderer.py | 5 ++--- .../templates/components/global_styles.css | 6 ++++++ .../templates/components/message_styles.css | 18 +++++++++++++++++- .../components/project_card_styles.css | 5 +++++ .../templates/components/session_nav.html | 6 +++--- .../components/session_nav_styles.css | 11 +++++++++++ claude_code_log/templates/index.html | 4 ++-- claude_code_log/templates/transcript.html | 2 +- test/test_tool_result_image_rendering.py | 5 ++--- 9 files changed, 49 insertions(+), 13 deletions(-) diff --git a/claude_code_log/renderer.py b/claude_code_log/renderer.py index 2052ca97..e4c0de9f 100644 --- a/claude_code_log/renderer.py +++ b/claude_code_log/renderer.py @@ -1290,8 +1290,7 @@ def format_tool_result_content( data_url = f"data:{media_type};base64,{data}" image_html_parts.append( f'Tool result image' + f'class="tool-result-image" />' ) raw_content = "\n".join(content_parts) has_images = len(image_html_parts) > 0 @@ -1469,7 +1468,7 @@ def format_image_content(image: ImageContent) -> str: # Create a data URL from the base64 image data data_url = f"data:{image.source.media_type};base64,{image.source.data}" - return f'Uploaded image' + return f'Uploaded image' def _is_compacted_session_summary(text: str) -> bool: diff --git a/claude_code_log/templates/components/global_styles.css b/claude_code_log/templates/components/global_styles.css index b9961ed3..816fbe92 100644 --- a/claude_code_log/templates/components/global_styles.css +++ b/claude_code_log/templates/components/global_styles.css @@ -118,6 +118,12 @@ pre { line-height: 1.5; } +/* Summary stats layout (used in index.html) */ +.summary-stats-flex { + display: flex; + gap: 3em; +} + /* Common card styling */ .card-base { background-color: #ffffff66; diff --git a/claude_code_log/templates/components/message_styles.css b/claude_code_log/templates/components/message_styles.css index 7cbd3a2e..95dc4eb4 100644 --- a/claude_code_log/templates/components/message_styles.css +++ b/claude_code_log/templates/components/message_styles.css @@ -525,6 +525,12 @@ font-size: 1.2em; } +.session-subtitle { + font-size: 0.9em; + color: #666; + margin-top: 4px; +} + /* IDE notification styling */ .ide-notification { background-color: var(--ide-notification-dimmed); @@ -841,4 +847,14 @@ details summary { .ansi-bold { font-weight: bold; } .ansi-dim { opacity: 0.7; } .ansi-italic { font-style: italic; } -.ansi-underline { text-decoration: underline; } \ No newline at end of file +.ansi-underline { text-decoration: underline; } + +/* Image styling */ +.tool-result-image, +.uploaded-image { + max-width: 100%; + height: auto; + border: 1px solid #ddd; + border-radius: 4px; + margin: 10px 0; +} \ No newline at end of file diff --git a/claude_code_log/templates/components/project_card_styles.css b/claude_code_log/templates/components/project_card_styles.css index 21fde152..48d0a53d 100644 --- a/claude_code_log/templates/components/project_card_styles.css +++ b/claude_code_log/templates/components/project_card_styles.css @@ -37,6 +37,11 @@ text-decoration: underline; } +.transcript-link-hint { + font-size: 0.6em; + color: #666; +} + .project-stats { color: #666; font-size: 0.9em; diff --git a/claude_code_log/templates/components/session_nav.html b/claude_code_log/templates/components/session_nav.html index 4d970081..99568db2 100644 --- a/claude_code_log/templates/components/session_nav.html +++ b/claude_code_log/templates/components/session_nav.html @@ -4,10 +4,10 @@