md2enex is a command-line tool that converts a directory of markdown files to an Evernote .enex export format, that can then be imported into Evernote.
- Preserves file creation dates and modification dates
- Preserves file titles
- Preserves formatting
- Supports embedded images, video, audio, and attachments
- Works on Mac, Windows, and Linux
- Install
pythonversion 3.14: Instructions - Install
pipx: Instructions
- Install
md2enexwithpipx:
pipx install git+https://github.com/karloskalcium/md2enex.git
md2enex [-o OUTPUT_FILE] DIRECTORY
Note: DIRECTORY should be a directory containing all of the .md files you want to import. This does not work recursively, so all files must be in the top-level of the directory.
The resultant .enex file can be imported into Evernote using the import feature.
You can get additional help by running:
md2enex -h
This tool uses pandoc to convert Markdown to HTML, and then converts that HTML to ENML (stripping some tags in the process), and then embeds this into the ENEX import/export format created by Evernote.
I used Exporter to export notes from Apple Notes app, and since Exporter does not add newlines to Markdown, md2enex uses the +hard_line_breaks option of pandoc to ensure proper line spacing. If your Markdown line spacing is correct in the source Markdown files you may want to remove that option in the create_note_content method.
Additionally, Exporter adds the title of the note as a top-level header in the note itself. This is not needed in Evernote, so if the first line of a note is a <h1> header, it is removed.
This tool supports embedding images and other media from your Markdown files into Evernote notes. Media are referenced in your Markdown using standard Markdown image syntax:
The media path should be relative to the Markdown file's location. When the file is converted, the media will be properly embedded in the Evernote note as resources with the correct MIME type.
This tool supports tags and keywords embedded in yaml frontmatter and converts them to evernote tags. For example see this test file.
A warning: Evernote can be finicky about notes; if notes have any unknown/unsupported tags in them, they can successfully import, and then they will disappear silently at some point (perhaps when they sync to the server?). So even though this tool tries to validate the import against the Evernote DTD, to be extra safe, check the number of notes at import, and confirm that same number of notes remains in Evernote after syncing/refreshing/closing/restarting. If notes disappear, it's probably because of some strange syntax that made its way from Markdown into the generated HTML and that Evernote does not accept.
Open an Issue. Pull requests welcome.
You can also ask a question in the discussions section.
- md2evernote
- Exporter - Apples Notes to markdown exporter
- Yarle - The ultimate converter of Evernote notes to Markdown
- Evernote2md - Convert Evernote .enex files to Markdown
This project uses uv for packaging and dependency management, and just as a task runner.
justto list available recipesjust checkto run lint, typecheck, and testsjust formatto auto-format the codebasejust lintto run the ruff linterjust typecheckto run pyrightjust unit-testto run tests with coverage