Skip to content

[Deepcast] Preserve hyperlinks in translated text - #30271

Merged
raycastbot merged 4 commits into
raycast:mainfrom
12ian34:ext/deepcast-preserve-hyperlinks
Aug 17, 2026
Merged

raycastbot merged 4 commits into
raycast:mainfrom
12ian34:ext/deepcast-preserve-hyperlinks

Conversation

@12ian34

@12ian34 12ian34 commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #30120

Deepcast currently sends plain text to DeepL, so copied hyperlinks are dropped. This change:

  • Reuses clipboard HTML when it matches the text being translated, and converts markdown links like [docs](https://example.com) to anchors
  • Sends that markup to DeepL with tag_handling: html so link targets survive translation
  • Copies and pastes the result as rich HTML, with a plain-text fallback

Plain text without links is unchanged.

Screencast

N/A. Behaviour change for existing Translate / Translate into … commands.

Checklist

npm run build, npm run lint, and npm test all passed. I have not yet imported the distribution build into Raycast.

Test plan

  • npm test in extensions/deepcast (11 passing)
  • npm run lint
  • npm run build
  • Copy linked text from a webpage, run Translate into … with clipboard source, paste into a rich-text app and confirm the link is still clickable
  • Paste markdown such as See [docs](https://example.com) into Translate and confirm the translated output keeps the URL
  • Translate plain text with no links and confirm behaviour is unchanged

Use DeepL HTML tag handling for clipboard HTML and markdown links so copy and paste keep clickable links.
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: deepcast Issues related to the deepcast extension platform: macOS platform: Windows labels Aug 16, 2026
@raycastbot

raycastbot commented Aug 16, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @mooxl @peter-gy @Popalay @MonsterDeveloper @YamenSharaf @EvanZhouDev @erics118 @riadhrebei @ishassan @shashankxrm @heyFlorentin @ridemountainpig you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="ext/deepcast-preserve-hyperlinks"
FORK_URL="https://github.com/12ian34/extensions.git"
EXTENSION_NAME="deepcast"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@12ian34
12ian34 marked this pull request as draft August 16, 2026 08:56
@greptile-apps

greptile-apps Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR preserves hyperlinks and rich formatting by carrying clipboard HTML through DeepL’s HTML translation mode and returning rich clipboard content with plain-text display handling.

  • Adds HTML and Markdown hyperlink detection, conversion, and display helpers.
  • Preserves clipboard provenance so HTML is used only when the clipboard is the actual input source.
  • Integrates rich copy, paste, and formatted preview behavior into translation commands.
  • Adds focused hyperlink-processing tests and a test script.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the current source-selection flow no longer associates clipboard HTML with explicit or selected text merely because their normalized text matches.

Important Files Changed

Filename Overview
extensions/deepcast/src/hyperlinks.ts Adds helpers for detecting, extracting, converting, and displaying HTML and Markdown hyperlink content.
extensions/deepcast/src/utils.ts Carries source provenance through translation and uses rich clipboard output for HTML translations.
extensions/deepcast/src/index.tsx Integrates formatted translation state, preview navigation, and rich copy/paste actions into the view command.
extensions/deepcast/src/components/TranslationView.tsx Displays HTML translations as readable Markdown and routes actions through the rich clipboard helpers.
extensions/deepcast/tests/hyperlinks.test.ts Covers fragment extraction, hyperlink detection and conversion, payload preparation, and rich clipboard formatting.

Reviews (4): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile

Comment thread extensions/deepcast/src/utils.ts Resolved
@12ian34

12ian34 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

I'll make the suggested updates and move from draft within 24 hours :)

@12ian34
12ian34 marked this pull request as ready for review August 16, 2026 23:06
@0xdhrv 0xdhrv self-assigned this Aug 16, 2026
- Remove clipboard HTML matching and normalization logic
- Preserve HTML only when clipboard content is the actual source
- Prevent selected text from acquiring unrelated rich formatting
- Update tests to verify plain text remains unformatted without HTML input

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved ✅

@raycastbot
raycastbot merged commit f5276eb into raycast:main Aug 17, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@12ian34).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: deepcast Issues related to the deepcast extension extension fix / improvement Label for PRs with extension's fix improvements platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Deepcast] preserve hyperlinks in pasted text

3 participants