Create cross reference links in Evernote [No Ruby] (OSX)
Create links within a single note. An alternate version for Create cross reference links in Evernote (OSX) that does not require the
pasteboard ruby gem.
- OS X (
- Evernote OSX client (
This package does not require the
pasteboardruby gem like the original one, but there might be some minor problems. Most evident ones are:
- after triggering the "Create cross reference" action, please wait 3 seconds without doing anything while the link is being generated. A dialog will pop up to tell you that the link has been generated when the workflow is finished.
- you won't be able to easily undo the operation (with 'cmd+z', for example).
- Option 1: Download "Create Cross Reference (no ruby) - applescript.workflow.zip", unzip and install as a service. (Updated 2015-5-1: Thanks to JMichael for suggestions)
- Option 2: Build your own workflow/service using Automator with the 3 scripts in this gist (see the screenshot for example)
Warning: The generated result (a link + styled anchor) will be written to your clipboard.
See a demo here
- In Evernote client, select text that you would like to set as "destination", right click and select "Service -> Create Cross Reference". This selected text will be your "anchor".
- You will be asked to enter a "label" for this destination (default value should be fine most of the time).
- Next you will be asked to enter the text for the generated link.
- The selected text will be replaced by a generated link and a styled anchor.
- Feel free to move the generated link to anywhere you want within the same note. Clicking on this link should take you to your anchor.
You can modify
create-cross-reference-links-0.applescript to style the generated link/anchor as you like.
Note for developers
Basically, this workflow does the following:
- Get selected text, prompt user for label text and link text.
- Create two
<a>elements of the form:
<a href="#label-text">Link text</a>for the link and
<a name="label-text">Selected Text</a>for the destination.
- Formulate these two elements into the OSX clipboard.
- Paste (with cmd + v) and replace the selected text.
- Since the Evernote client will automatically add
evernote-html-snippet://to links with
#, use applescript to scan the whole note and get rid of all these redundant strings.
As you can see, step 5 is not very elegant as it operates on the html content of the whole note. In the original version, we can use
pasteboard to formulate the clipboard/pasteboard data precisely as type
com.evernote.ce.raw (a UTI defined by Evernote) so that the Evernote client will not add