Skip to content

Instantly share code, notes, and snippets.

@AndyCarnevale
AndyCarnevale / script.js
Last active March 22, 2024 15:50
Claude Chat Formatter
/**
* Claude Chat Formatter
*
* This script is designed to enhance the readability and distinction of messages in the Claude chat interface by either
* prepending labels to messages or wrapping messages in custom XML-like tags. It's particularly useful for clearly
* distinguishing between user and AI messages, making it easier to copy and paste the conversation with clear attribution.
*
* Functionality:
* - `prependLabels()`: Prepends a label indicating "user:" or "ai:" at the start of each message.
* - `tagMessages()`: Wraps each message with custom XML-like tags, <user>...</user> for user messages and <ai>...</ai> for AI messages.