Skip to content

nemanjavlahovic/copy4llm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy4LLM Logo

Copy4LLM

Chrome Extension Manifest V3 License

A powerful Chrome extension that intelligently extracts and converts web content into clean, LLM-optimized markdown format.

Perfect for feeding web content to ChatGPT, Claude, or any other AI language model.

✨ Features

  • 🎯 Smart Content Extraction - Advanced scoring algorithm identifies main content while filtering out ads, navigation, and clutter
  • 📝 Markdown Conversion - Converts HTML to clean, properly formatted markdown
  • Multiple Access Methods - Right-click context menu and keyboard shortcut (Ctrl+Shift+C)
  • 📌 Selection Support - Works with selected text or entire pages
  • 🔗 Context Preservation - Automatically includes page title and URL for better AI context
  • 🚀 Performance Optimized - Smart caching and robust clipboard handling
  • 🎨 Clean Output - Removes excessive whitespace, normalizes formatting, and optimizes for LLM consumption

🚀 Quick Start

Installation

  1. Clone or download this repository
  2. Open Chrome and navigate to chrome://extensions/
  3. Enable Developer mode (toggle in top-right corner)
  4. Click "Load unpacked" and select the project folder
  5. Start using - right-click on any webpage and select "Copy4LLM"

Usage

Right-click method:

  • Navigate to any webpage
  • Right-click anywhere (or select text first for partial extraction)
  • Choose "Copy4LLM" from the context menu
  • Clean markdown is automatically copied to your clipboard

Keyboard shortcut:

  • Press Ctrl+Shift+C (or Cmd+Shift+C on Mac) on any webpage
  • Full page content is processed and copied as markdown

🔧 How It Works

  1. Content Detection - Intelligent scoring system analyzes page structure to identify main content
  2. Smart Cleanup - Removes ads, navigation, scripts, and other non-essential elements
  3. Markdown Conversion - Leverages Turndown.js for high-quality HTML-to-markdown conversion
  4. Content Optimization - Normalizes formatting, removes excessive whitespace, and structures output for LLM consumption
  5. Context Enhancement - Automatically includes page metadata (title, URL) for better AI understanding
  6. Robust Clipboard Handling - Multiple fallback methods ensure reliable copying across different environments

📂 Project Structure

copy4llm/
├── manifest.json          # Extension configuration (Manifest V3)
├── background.js          # Service worker - context menu & messaging
├── content.js            # Content extraction & processing logic
├── popup.html            # Extension popup interface
├── libs/
│   └── turndown.js       # HTML to Markdown converter library
└── icons/                # Extension icons (16px, 32px, 48px, 128px)

🛠️ Development

Prerequisites

  • Google Chrome browser
  • Basic knowledge of JavaScript and Chrome Extensions

Setup

  1. Clone this repository
  2. Open Chrome and navigate to chrome://extensions/
  3. Enable "Developer mode"
  4. Click "Load unpacked" and select the project directory
  5. Make your changes and click the refresh icon to reload

Key Files

  • content.js - Modify content extraction logic and selectors
  • background.js - Update context menu behavior and messaging
  • manifest.json - Configure permissions and extension metadata

🎨 Customization

Content Selectors

Edit the selector arrays in content.js to customize extraction:

const USELESS_SELECTORS = [
  // Add selectors for elements to remove
  '.advertisement', '.popup', '.cookie-banner'
];

const CONTENT_SELECTORS = [
  // Add selectors for main content detection
  'article', 'main', '.content', '.post'
];

🚀 Publishing to Chrome Web Store

  1. Prepare Package

    • Test thoroughly across different websites
    • Create store listing screenshots
    • Write compelling description
  2. Developer Account

  3. Upload & Submit

    • Create ZIP file (exclude README.md)
    • Upload via developer dashboard
    • Complete store listing information
    • Submit for review (typically 1-3 business days)

🔒 Permissions

Permission Purpose
contextMenus Create right-click menu item
activeTab Access current tab content when activated
clipboardWrite Copy processed content to clipboard
notifications Show success/error notifications
scripting Inject content scripts dynamically

🐛 Troubleshooting

Issue Solution
Extension not visible Enable Developer Mode in Chrome
Context menu missing Reload extension in chrome://extensions/
Copy functionality broken Check site's clipboard access permissions
Poor content extraction Site may use non-standard HTML structure

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Turndown.js - Excellent HTML to Markdown converter
  • Chrome Extensions team for comprehensive documentation and APIs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages