Renders a Claude.ai conversation JSON export into a styled HTML page for easy reading and sharing.
This bookmarklet is designed to be used on a page displaying the raw JSON output of a Claude.ai conversation (e.g., after using the "Claude Conversation Tree JSON Exporter" bookmarklet). It parses this JSON and generates a user-friendly HTML representation of the conversation in a new browser tab.
- HTML Rendering: Converts the JSON conversation data into a clean, readable HTML format.
- Dynamic Library Loading: Loads
marked.jsfor Markdown parsing andhighlight.jsfor syntax highlighting dynamically. - Message Path Reconstruction: Correctly orders messages based on the conversation tree.
- Artifact Handling: Identifies and specially formats
<antArtifact>blocks, including syntax highlighting for their content. - Markdown Support: Parses Markdown within messages for proper formatting (bold, italics, lists, etc.).
- Syntax Highlighting: Applies syntax highlighting to code blocks within messages and artifacts.
- Styling: Uses Pico.css for a clean, responsive layout and custom styles for messages, sender differentiation, and artifacts.
- Downloadable HTML: Includes a "Download HTML" button on the rendered page to save the conversation locally.
- Metadata Display: Shows conversation title, creation date (linking to the original chat), and project name if available.
- Easy Mode:
- Go to the Bookmarklet Installer
- Drag the generated link to your bookmarks bar.
- Hard Mode:
- Copy the entire JavaScript code from the claude_json_renderer.js file.
- Go to the generic Bookmarklet Installer.
- Paste the code into the installer.
- Name the bookmarklet (e.g., "Render Claude JSON").
- Drag the generated link to your bookmarks bar.
- First, obtain the JSON export of a Claude.ai conversation. You can use the "Claude Conversation Tree JSON Exporter" bookmarklet for this. This will typically open the JSON data in a new tab.
- On the page displaying the raw JSON data (it should just be plain text starting with
{...}), click the "Render Claude JSON" bookmarklet. - A new tab will open, displaying the formatted HTML version of the conversation.
- You can use the "Download HTML" button on this new page to save the rendered conversation.
- Loads Dependencies: Dynamically loads
marked.js(for Markdown to HTML) and sets its options.highlight.jsis linked in the generated HTML for syntax highlighting. - Parses JSON: Assumes the current page's
document.body.textContentis the JSON string and parses it. - Reconstructs Conversation Path: Traverses the message tree from the
current_leaf_message_uuidto the root to get messages in chronological order. - Processes Messages:
- Extracts text content from message parts.
- Identifies and formats
<antArtifact>blocks, attempting to detect language (JSX/JavaScript) for syntax highlighting. - Converts the message text (including formatted artifacts) from Markdown to HTML using
marked.parse().
- Generates HTML: Constructs a complete HTML document string with:
- Pico.css and highlight.js CSS links.
- Custom CSS for styling conversation elements.
- Conversation metadata (title, created date, project).
- A download button.
- Each message styled based on sender (human/assistant).
- JavaScript for
hljs.highlightAll()and thedownloadHTML()function.
- Displays HTML: Opens a new blank window (
window.open('', '_blank')) and writes the generated HTML string into it usingnewWindow.document.write().
- Depends on external CDNs for
marked.js,highlight.js, andPico.css. - The artifact parsing specifically looks for
<antArtifact>tags and extractsidentifier,title, and content. - The download function temporarily hides the download button itself from the saved HTML.
- Designed to work with the JSON structure provided by the Claude API endpoint used by the "Claude Conversation Tree JSON Exporter" bookmarklet.
The full source code is available on GitHub.
MIT License - See LICENSE
Created by Oskar Austegard