Giter Site home page Giter Site logo

md2enex's Introduction

md2enex

CI LICENSE PYTHON

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.

Features

  • Preserves file creation dates and modification dates
  • Preserves file titles
  • Preserves formatting
  • Works on Mac, Windows, and Linux

Install

Install python and pipx

  1. Install python verion 3.10 or later: Instructions
  2. Install pipx: Instructions

Install md2enex

  1. Install md2enex with pipx:
pipx install git+https://github.com/karloskalcium/md2enex.git

Using the tool

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 --help

Markdown formatting notes

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 markdown+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 code.

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.

The HTML generated by the markdown will be validated against the Evernote DTD. If validation fails, the file will be skipped. Additionally, img and figure tags will be detected and if found, the file will be skipped, as embedded media is not supported by this converter.

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.

Bugs, feature requests, or contributions

Open an Issue. Pull requests welcome.

You can also ask a question in the discussions section.

Other tools

Contributing

This project uses Poetry for packaging and dependency management.

Most of the things you need to do are targets in the makefile.

  • make to get a list of targets
  • make test to run the tests
  • make lint to run the ruff linter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.