abachman / vscode-copyfordocumentation

A VS-Code plugin for copying code for pasting into conversational contexts.
https://marketplace.visualstudio.com/items?itemName=abachman.copyfordocumentation
MIT License
1 stars 0 forks source link

copy for slack doesn't use rich text #3

Open Geczy opened 1 month ago

Geczy commented 1 month ago

any idea what's happening here?

CleanShot 2024-07-17 at 08 53 33

abachman commented 1 month ago

ooo, this could be a difference in our Slack settings.

I'm only using the plugin heavily for one account at the moment, and I've enabled [x] Format messages with markup for it. That's under the "Advanced" Preferences menu, "Input options" section. This is on the desktop Slack.app on macos.

Screenshot 2024-07-22 at 9 02 11 AM

mostly related: A "Copy as Rich Text" option would be interesting. I've used this page / app for editing Google Slides presentations, I suspect it wouldn't be too awful to implement the same for VS Code.

Geczy commented 1 month ago

yep it works with that option checked. i wish there was a quick way to toggle it off and on because i use it as well for some other generated messages, but turn it back off when i'm done and want to just type messages myself with keyboard rich text shortcuts

Geczy commented 1 month ago

i just realized that if you copy any text in a <pre>, like on your browser, and paste it to slack, it will paste as a code block

so i'm wondering if this vscode extension can copy with rich text instead of markdown?

see vid: CleanShot 2024-07-24 at 07 44 43

Geczy commented 1 month ago

this works to copy both rich text and plain text to keyboard, letting mac decide which one to paste depending on source:

plainText="Your plain text here"

htmlContent="<b>bolded text</b>" # Example HTML content

# Convert HTML content to hex for the clipboard
htmlHex=$(echo "$htmlContent" | hexdump -ve '1/1 "%.2x"')

# Use AppleScript to set both the plain text and the HTML content of the clipboard
osascript -e "set the clipboard to {text:\"${plainText}\", «class HTML»:«data HTML${htmlHex}»}"