Jump to content
Hackademic

mac (Archived) Markdown -> Evernote -> Markdown via Applescript

Recommended Posts

These scripts scratched an itch I had to be able to (1) write in Markdown and save it to Evernote as clean HTML and (2) get the text of an Evernote note in Markdown format. There is one script per function. 

 

The requirements are few but important. For the Markdown2Evernote script, you will need MultiMarkdown already installed. If it's installed, it should be in "/usr/local/bin/multimarkdown". For the Evernote2Markdown script, you will need the html2text python script. If you have Brett Terpstra's Markdown Service Tools, you can find the code for this script inside of the "md - Convert - HTML to Markdown" Service. Copy the code and save it as a Python script. Or, you can simply download the script here: http://www.aaronsw.com/2002/html2text/html2text.py . Once you download or save the script, you MUST change the second to last line to data = sys.argv[1].decode('utf8'). This will allow the Applescript to pass input via the "do shell script" command. If you don't change the input line in the python code, the Applescript won't work.

 

The Markdown2Evernote script will accept text from the clipboard. This text can begin with 3 types of Metadata: Title, Notebook, and Keywords. For example, 

 

Title: This is my title

Notebook: Inbox

Keywords: tag1, tag2

 

These metadata types can be substituted with "#", "=", and "@". For example:

 

# This is my title

= Inbox

@ tag1, tag2

 

If you don't insert this metadata, the script will title the new note with the data and put it in your default notebook without any tags. 

 

The script takes the Markdown-styled text from the clipboard, extracts the metadata (if it's there), converts it to HTML, and creates a new HTML Evernote note. You can find the script here: bit.ly/1aKzVN2 

 

The Evernote2Markdown script will take your currently selected Evernote note and use the html2text script to convert it to Markdown. It will also create a new folder (if it doesn't exist) entitled "Evernote_Markdown_Notes" inside of your Documents folder. It will then create a .md text file with the title of your Evernote note and save it to that folder. Finally, the script will open that .md file in your text editor of choice (simply change the myTextEditor property at the start of the script). For the script to function properly, be sure you change the html2text property to the file path to that script. The property is predefined as "/Users/[username]/Path/to/html2text.py", which is obviously useless. You can get the Applescript here: http://bit.ly/1bgAPeW 

 

For those of you who love Markdown and Evernote, these scripts might be of help. 

 

stephen

 

hackademic.postach.io

 

 

 

 

  • Like 1

Share this post


Link to post
Guest
This topic is now closed to further replies.

×
×
  • Create New...