Perplexity Code Block Copy (AFU IT)

Enhanced code blocks in Perplexity with better selection and copy features for inline code

Verze ze dne 08. 05. 2025. Zobrazit nejnovější verzi.

Autor
afu-it
Hodnocení
0 0 0
Verze
1.0
Vytvořeno
08. 05. 2025
Aktualizováno
08. 05. 2025
Size
10,2 KB
Licence
MIT
Spustit na

Description
This userscript make code blocks in Perplexity AI by adding one-click copy functionality and custom styling. It makes inline code stand out with a light blue background while maintaining the default styling for multi-line code blocks.

Easy to understand
Just select the code, and it will auto copied the code
But what if its a long code? Just double click it, it will copied all the code!

Features
- Inline code highlighting: Single-line code within paragraphs gets a distinctive #20b8cb background with black text
- Easy copying: Click inline code to copy it, or select specific text to copy just that portion
- Double-click to copy all: Double-click any code block to copy its entire content
- Visual feedback: A small "Copied!" tooltip appears next to your cursor when text is copied
- Smart styling: Only applies styling after answers are fully generated

Installation Tutorial

1. Install Tampermonkey:
- Visit the [Chrome Web Store](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) (for Chrome) or [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/) (for Firefox)
- Click "Add to Chrome/Firefox" to install the extension

2. Create a new script:
- Click on the Tampermonkey icon in your browser toolbar
- Select "Create a new script"
- Delete any default code that appears

3. Add the script:
- Copy and paste the entire userscript code into the editor
- Click File > Save or press Ctrl+S

4. Use the enhanced code blocks:
- Visit Perplexity AI (refresh if you're already there)
- Inline code will now have a light blue background
- Click on inline code to copy it
- Select text within any code block to copy just that selection
- Double-click any code block to copy its entire content

Usage Tips
- For inline code like `console.log()`, just click once to copy
- For multi-line code blocks, select specific text to copy portions
- Double-click anywhere in a code block to copy the entire block
- The tooltip appears right next to your cursor for immediate feedback