vitor Posted March 7, 2021 Author Share Posted March 7, 2021 Major update (which you will likely not notice). Switched to using MultiMarkdown, which means more transformations to HTML and a few more for BBCode and RTF (subscript). Also removed support for footnotes in BBCode. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater. Link to comment
vitor Posted August 10, 2021 Author Share Posted August 10, 2021 Update. Add Universal (text) Actions. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater. Link to comment
Joaquim Posted August 18, 2021 Share Posted August 18, 2021 Hi vitor, first of thank you for all your workflows, I'm using many of them on a daily basis! Unfortunately, I have some trouble with Markdown Transform. I'm working with Hook and Evernote and I would like to use your workflow to transform Hook-Links to rtf in Evernote (example: [pdf](hook://file/1yUfmPSUz?p=c2NpZWJvL0JpYmxpb3RoZWs=&n=Horn%20%E2%80%93%20Der%20geheime%20Krieg%20(2007).pdf#p=182). However, when I invoke your workflow on the selection, it returns "pdf" formatted as a Hyperlink (underlined), but it is not a link and I can't click on it. If I do the same in Apple Mail, it is a link, but I still can't click on it. In TextEdit, however, the workflow works fine. I'm on a MacBook Pro with Catalina. Do you have any idea why that is? Thanks a lot! Link to comment
deanishe Posted August 18, 2021 Share Posted August 18, 2021 2 hours ago, Joaquim said: Do you have any idea why that is? Do any hook:// links work in Evernote or Mail? If it works in some apps, but not in others, the likely answer is that those apps won’t let you open hook:// URIs. Link to comment
Joaquim Posted August 18, 2021 Share Posted August 18, 2021 27 minutes ago, deanishe said: Do any hook:// links work in Evernote or Mail? Yes, if I transform the md-link with another tool, it works. Also, if I just paste a hook:// link, it works as well. Thanks for your quick reply though! Link to comment
vitor Posted August 18, 2021 Author Share Posted August 18, 2021 3 hours ago, Joaquim said: first of thank you for all your workflows, I'm using many of them on a daily basis! Glad to know! However, as to your question, no idea. The RTF transformation is slightly hacky in the sense that it relies on simulating ⌘V to paste at the end. The apps where you’re saying it doesn’t work are apps I don’t use. 53 minutes ago, Joaquim said: if I transform the md-link with another tool, it works. What’s the tool? There aren’t many to do this conversion; perhaps I can understand the problem from seeing how they do it. Link to comment
Joaquim Posted August 18, 2021 Share Posted August 18, 2021 Thanks, @vitor! 1 hour ago, vitor said: What’s the tool? There aren’t many to do this conversion; perhaps I can understand the problem from seeing how they do it. I'm working with EverTool, which unfortunately is a paid app and thus not open source. It is designed for use with Evernote, but you can use it with any rich text editor, as it simply takes data from the clipboard and transforms it to rtf. (There are also other formatting options, too.) However, I would much prefer a solution via Alfred, as it would integrate better with my workflow. Thus far, I have a workflow that gets the page index and label of the current document in Skim, combines it with the corresponding hook://-Link and outputs it as a markdown-Link (e.g. [p. 9](hook://file/1yUfmPSUz?p=c2NpZWJvL0JpYmxpb3RoZWs=&n=Horn%20%E2%80%93%20Der%20geheime%20Krieg%20(2007).pdf#p=1). With your workflow I'd be able to transform this to rtf and paste it to my note-taking app. This would work much faster than Dan Shefflers applescript, which does a similar thing and inspired me in the first place. Link to comment
deanishe Posted August 18, 2021 Share Posted August 18, 2021 35 minutes ago, Joaquim said: thus not open source Doesn't really matter. What's relevant is what it puts on the clipboard. Can you make a link and check the RTF that it puts on the clipboard with Clipboard Viewer? https://langui.net/clipboard-viewer/ vitor 1 Link to comment
Joaquim Posted August 18, 2021 Share Posted August 18, 2021 (edited) 13 minutes ago, deanishe said: Can you make a link and check the RTF that it puts on the clipboard with Clipboard Viewer? Sure thing. Using my example, it gets me: <meta charset='utf-8'> <p class="evertool-paragraph" style="font-size: 14px; color: black; font-family: 'Segoe UI', 'Source Sans Pro', Calibri, Candara, Arial, sans-serif, 'Microsoft JhengHei', sans-serif;"><a href="hook://file/1yUfmPSUz?p=c2NpZWJvL0JpYmxpb3RoZWs=&n=Horn%20%E2%80%93%20Der%20geheime%20Krieg%20(2007).pdf#p=1" style="font-size: 14px; color: #2FA4E7; font-family: 'Segoe UI', 'Source Sans Pro', Calibri, Candara, Arial, sans-serif, 'Microsoft JhengHei', sans-serif;">p. 9</a></p> <br class="Apple-interchange-newline"> If I paste this to Evernote, it gets me, as expected, this: p. 9 I don't know why the Clipboard Content is HTML, while the output is RTF. Edited August 18, 2021 by Joaquim Link to comment
vitor Posted August 18, 2021 Author Share Posted August 18, 2021 24 minutes ago, Joaquim said: I don't know why the Clipboard Content is HTML, while the output is RTF. Looking at their demo video, I see no indication they’re producing RTF. It seems highly unlikely, given the code syntax highlighting. It seems more likely that Evernote understands the pasted HTML and is parsing it. MardownTransform supports HTML conversion. Have you tried that and pasting it into Evernote? Link to comment
Joaquim Posted August 18, 2021 Share Posted August 18, 2021 21 minutes ago, vitor said: MardownTransform supports HTML conversion. Have you tried that and pasting it into Evernote? Yes, but unfortunately Evernote doesn't parse it. Link to comment
deanishe Posted August 19, 2021 Share Posted August 19, 2021 18 hours ago, vitor said: MardownTransform supports HTML conversion. Have you tried that and pasting it into Evernote? Evernote accepts pasted HTML. The problem is that the HTML generated by the workflow is put on the pasteboard as plain text, not as HTML. Link to comment
vitor Posted August 20, 2021 Author Share Posted August 20, 2021 21 hours ago, deanishe said: Evernote accepts pasted HTML. The problem is that the HTML generated by the workflow is put on the pasteboard as plain text, not as HTML. Guessing you’re referring to the NSPasteboardTypes. I’ve seen you mention something to that effect before but I’ve never worked with those. I’ll look into it. Not today, though. Also guessing that to preserve the type I might need to paste by simulating ⌘V instead of using Alfred’s Copy to Clipboard Output, right? Link to comment
deanishe Posted August 20, 2021 Share Posted August 20, 2021 1 hour ago, vitor said: Also guessing that to preserve the type I might need to paste by simulating ⌘V instead of using Alfred’s Copy to Clipboard Output, right? Yeah. Alfred puts everything on the pasteboard as plaintext (or RTF), so you'll need to populate the pasteboard yourself: ObjC.import('AppKit'); function copyLink(url, title) { title = title || url; let html = `<a href="${url}">${title}</a>`; let pboard = $.NSPasteboard.generalPasteboard; pboard.clearContents; pboard.setStringForType(url, 'public.url'); pboard.setStringForType(title, 'public.url-name'); pboard.setStringForType(html, 'public.html'); pboard.setStringForType(url, 'public.utf8-plain-text'); } vitor 1 Link to comment
Joaquim Posted August 20, 2021 Share Posted August 20, 2021 Thanks, @deanishe! That helps me a lot. Now my workflow puts an HTML link on the clipboard, which is exactly what I needed. I'm glad it works now! Link to comment
vitor Posted August 25, 2021 Author Share Posted August 25, 2021 On 8/20/2021 at 12:46 PM, deanishe said: Yeah. Alfred puts everything on the pasteboard as plaintext (or RTF), so you'll need to populate the pasteboard yourself Hadn’t had the chance to look into this yet, but thank you for the code sample; it’ll speed it up when I do. Link to comment
Chris Messina Posted August 25, 2021 Share Posted August 25, 2021 @vitor can I request an enhancement? When I attempt to convert this string into Markdown using Markdown to HTML: [test](https://test.com) ...the result includes enclosing <p> tags. How can I suppress the paragraph tags? <p><a href="https://test.com">test</a></p> Link to comment
deanishe Posted August 25, 2021 Share Posted August 25, 2021 13 minutes ago, Chris Messina said: How can I suppress the paragraph tags? You might be better off with a link-specific workflow. Most Markdown converters are aimed at larger blocks of text and correspondingly wrap their output in block tags. I mean, the workflow has no way of knowing if you've selected a completely standalone link or a link somewhere in the middle of a document, so it can't really know whether to wrap its output in <p> tags or not. That way, you can also have a better link representation, too. This is the code I use to generate links to messages in MailMate: https://github.com/deanishe/CopyLink.mmBundle/blob/master/Support/bin/copylink Apart from no block tags in the HTML and no explicit formatting in the RTF representation, it also puts the URL (and page title) on the clipboard, so you can also run things like Alfred's Universal Actions for URLs against it. Chris Messina 1 Link to comment
vitor Posted August 27, 2021 Author Share Posted August 27, 2021 Update. Set correct pasteboard type for HTML. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater. Chris Messina 1 Link to comment
vitor Posted November 30, 2021 Author Share Posted November 30, 2021 Update. Better handling of images when given as HTML tags rather than Markdown. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater. Chris Messina 1 Link to comment
vitor Posted March 4, 2022 Author Share Posted March 4, 2022 Update. Better handling of code blocks with Markdown syntax highlighting. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater. Link to comment
biomarx Posted March 7, 2022 Share Posted March 7, 2022 Hi there, I love this workflow! I now have the opposite problem: I am using Craft.do and it seems to not allow pasting RTF but does accept Markdown! Does one exist or is there a way to make an RTF or HTML -> Markdown workflow? (at minimum to keep bold, italics, and links?). Thanks! Joe Link to comment
vitor Posted March 7, 2022 Author Share Posted March 7, 2022 39 minutes ago, biomarx said: I love this workflow! Thank you for the kind words. 39 minutes ago, biomarx said: Does one exist or is there a way to make an RTF or HTML -> Markdown workflow? It’s possible, though I don’t have a tool to recommend. That won’t be added to the Workflow because it’s really niche and would essentially be a whole new Workflow. In almost a decade since the Workflow has existed, it’s the first time that has come up. Its purpose is to convert Markdown to BBCode for use in this forum; everything else (HTML and RTF) is icing on the cake. 46 minutes ago, biomarx said: at minimum to keep bold, italics, and links? Even if you only wanted to keep those tags, you’d still have to purposefully ignore all others so they don’t remain in the final result and you’d have to make deliberate decisions on formatting. biomarx 1 Link to comment
biomarx Posted March 7, 2022 Share Posted March 7, 2022 Thanks Vitor, I did find this js page that allows quick paste/copy to transform into markdown. https://euangoddard.github.io/clipboard2markdown/ Link to comment
vitor Posted June 22, 2022 Author Share Posted June 22, 2022 Updated to 2022.1. Adjustments to list outward spacing in IPBoard. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now