How to make Evernote support code syntax highlight and formatting

evernoteformatting

I use Evernote as my PKM; it's just so convenient and it's cross-platform. It's a pity that code in HTML page is not supported perfectly in Evernote.

It sucks if we paste code directly into Evernote; formatting and syntax highlighting will both be lost. I try to paste code into another website which support them (e.g., Github's "gist") and then copy from it, but this still remains useless.

Is there a better and convenient way to make Evernote support code formatting better so that I can use it as a code library?

Best Answer

The method that I've found that works best for me (although it is a bit of a kludge) is to email my Evernote account the code as a .txt file, or alternately wrapped by the <code></code> HTML tags in the body of the email. I've got just over 3000 notes incorporating this sort of format. Most of what I've used this for is HTML, Javascript and Ruby on Rails files.

It seems that the email-to-note gateway treats the content just a little differently than just cutting and pasting it in my experience. The one caveat I would offer is that this method probably will not work if you are using XML structures, due to the native file structure of native notes. Good luck!