Skip to content

clip APIs for other content types (HTML, rich text, etc) #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
phillco opened this issue Nov 19, 2021 · 1 comment
Closed

clip APIs for other content types (HTML, rich text, etc) #432

phillco opened this issue Nov 19, 2021 · 1 comment

Comments

@phillco
Copy link

phillco commented Nov 19, 2021

My use case here is dictating a long, formatted document in a native application which supports accessibility APIs (such as Notational Velocity, or writing markdown in an editor), then pasting the final content into Google Docs, and ideally the formatting "just works" so I don't have to do a bunch of manual fixes.

Alas, Google Docs can be hit or miss with accepting a formatted clipboard from other sources. It does do quite well with RTF/HTML. Thus, it looks like the simplest way forward is to take the content from the native application, convert it into RTF/HTML using a tool like pandoc, possibly apply other manual fixes that are needed [1], then put it on the clipboard so it can be pasted into Google Docs.

I can do this with third party utilities on Mac pretty easily:

osxclipboard -o "public.txt" | pandoc -f markdown -t html | osxclipboard -i public.html

(This actually works pretty darn well for Markdown input -- I was very surprised by the fidelity after pasting into the doc)

If Talon had native APIs for this I could skip some of the subprocess calls. I think there might be more interesting future use cases in more accessibility-powered dictation use cases that involve simple formatting.

One other use case: I'd like to implement is to improve Google Doc's handling of plain text pasting, by sneakily converting to HTML ourselves.

For example, if you paste this string into Google Docs:

- A
- B
- C

It does not turn A, B, and C into a bulleted list, but many other editors do this automatically and it's quite convenient.

With Talon, we can simply read the clipboard and convert the contents to HTML ourselves if necessary, possibly so fast that the user doesn't even notice.

We could also go the other way: right now, if you copy a bulleted list in Google Docs and paste it into a plain text field, the list is lost entirely. But with pandoc we can convert it to a nice Markdown list with all of the HTML garbage stripped.

One other thought here, but if we could do this entirely by intercepting the cmd-v shortcut and injecting our own logic, this could be a nice way to pitch the value of Talon to people without any accessibility problems. "Instantly improve GDocs without having to use voice at all".

[1] Another personal example: applying company-specific fonts

@lunixbochs
Copy link

oh we have this in the beta btw, see clip.mime()

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

No branches or pull requests

2 participants