Jump to content
The Qodesmith

A script/add-on to colorize code in Evernote?

Recommended Posts

Hello All!

 

While I know Evernote isn't tailored for coders, I've tried to set up my EN styling to help. For instance, I use a mono-space font as default this way when I paste in code, things will look readable (or familiar, at least).

 

I use Sublime as my editor of choice, like many other programmers, and Sublime will colorize your code as you type to help visualize what's going on. While I don't expect EN to do something like this, I was wondering if there was a script or some add-on that could accomplish this. Here would be the workflow:

  1. Paste code into a new note
  2. Select the code (or portion of text) you'd like to colorize
  3. Run script or add-on
  4. The selected code is now colorized as in Sublime and other text editors

Does something like this exist? Is it possible to create this in the EN universe? Not really sure of what can and can't be done here in EN land, but I'd sure like to find out! I've attached a screenshot of the colorization in Sublime for a visual reference. Thanks for any tips and constructive comments!

 

post-98385-0-45052900-1437574368_thumb.p

Share this post


Link to post

Totally answered my own question. This may be for Sublime specific users, but there is a downloadable package called SublimeHighlight. Once in Sublime, it allows you to copy text as RTF which can then be successfully pasted into EN with all the syntax highlighting. Awesomeness!

Share this post


Link to post

In fact, ultraEdit and Notepad++ also support copy as RTF, which is a very good solution for code highlight.

but the core problem is, evernote will add extra spaces in paste result, which makes none of these solution works good enough.

check:

and

 

Share this post


Link to post
19 minutes ago, bootislands said:

the core problem is, evernote will add extra spaces in paste result, which makes none of these solution works good enough.

I don't use Evernote as a code repository; but I do store snippets of code for reference.
Below is a sample of a note with applescript code I've saved from the Script Editor app.

Yes, it may not have the exact spacing as in the editor, and possibly I should change the font.
This seems adequate for my needs.
I tried the new code block feature but I lost all the formatting.
What am I missing?

screenshot.png.445966fc09eb78a91e8120ccd

Share this post


Link to post

@DTLow The behavior has trigger point. Your case seems adequate to me too, whereas check this JS code:

If EN add spaces to make

/./g

become

/. / g

, it's totally different.

Animation1.gif

Share this post


Link to post
8 hours ago, bootislands said:

but the core problem is, evernote will add extra spaces in paste result, which makes none of these solution works good enough.

So, since I can't trust Evernote to always paste my code *exactly* as I copied it, I can't use Evernote for storing code snippets.  You gave one JavaScript example, but who knows how many other cases also cause the insertion of spaces or other changes.

Evernote has recently added a "Code Block" feature in EN Mac 6.5 Beta 3 Release Candidate , and I would guess it will make its way into the EN Win app as well.  But until it is working perfectly in a public, general release, I will continue to store my code snippets elsewhere.  I am using Quiver The Programmer's Notebook , and it works very well.  Unfortunately, it is available only for the Mac.

EDIT:  Fri, Feb 19, 2016 at 5:18 PM CST

Evernote has just posted: Evernote for Mac 6.5 Released 

Edited by JMichaelTX
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...