Create a gist now

Instantly share code, notes, and snippets.

@dasevilla / Secret
Last active Mar 24, 2016

What would you like to do?
Evernote to Markdown


osascript export-selected.scpt \
    | saxon -xsl:enml2xhtml.xslt -s:- \
    | pandoc -f html -t markdown_strict \

open -a marked

Install the dependies:

$ brew install haskell-platform saxon
$ cabal update
$ cabal install pandoc
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl=""
<!-- The goal of this stylesheet is to generate XHTML from ENML -->
<xsl:output method="xhtml" indent="yes"
doctype-public="-//W3C//DTD HTML 4.01//EN" />
<!-- Handle en-note -->
<xsl:template match="en:en-note">
<html xmlns="" xml:lang="en">
<title>Exported note</title>
<!-- Handle en-todo -->
<xsl:template match="en:en-todo[@checked=true()]">
<xsl:text>[X] </xsl:text>
<xsl:template match="en:en-todo[@checked=false()]">
<xsl:text>[ ] </xsl:text>
<!-- Handle en-crypt -->
<!-- Handle en-media -->
<!-- Output unknown tags without modification -->
<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="node()"/>
<xsl:template match="@*|text()|comment()|processing-instruction()">
-- Export ENML from the first selected note
tell application "Evernote"
set theNotes to selection
if length of theNotes > 0 then
set theNote to first item of theNotes
set theContent to ENML content of theNote
set the clipboard to theContent
end if
end tell
return theContent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment