Jump to content

REQUEST: Feature request: syntax highlighting for code


Recommended Posts

  • Level 5*

Yeah that would be great.  Not sure if/when it will ever happen since EN can't even seem to handle basic formatting correctly.

There are still lots of problems with bulleted and number lists, particularly when you copy/paste.

And copy/paste to/from EN also continues to be a problem.

 

The best suggestion I can offer is to use another app to obtain your code coloring, and then save as a file and attach at the appropriate location in the Note.  Then you could just double-click on the attachment to open in your other app.

 

Good luck.

Link to comment

Support for code would be great! I registered just to post the same thing.

 

Even if it's a simple /code block that indents the code and uses monospace font and doesn't ***** with puncuation/spelling/quotes, etc.

 

Somewhat ironically, this forum software actually has the <> code block. e.g.

if (evernote has feature.codeblock) {   releaseballoons();} else {   disappoint();}
Link to comment

even as a replacement for code block, we could kill two birds with one stone and request Markdown support, which would have the syntax highlighting and code blocks already, and we can simply use back ticks. would be lovely and accommodating to anyone that uses Markdown.

Link to comment
  • Level 5*

even as a replacement for code block, we could kill two birds with one stone and request Markdown support, which would have the syntax highlighting and code blocks already, and we can simply use back ticks. would be lovely and accommodating to anyone that uses Markdown.

There's a lengthy topic elsewhere in the forums with people requesting Markdown already. Big hangup in my view is that it would be pretty much write-only, since Markdown cannot generally express the same things as Evernote's cut-down version of HTML can so round-tripping would probably not be pretty.

 

I'd say it's pretty unlikely that Evernote is going to plug in a syntax highlighter to its editor; most people are not developers, and a lot of people would be a lot happier with, say, better lists (bulleted and numbered) and defined styles. Of course, it could happen, but I wouldn't bet on it any time soon...

Link to comment
  • 3 weeks later...

+1

 

I've been wanting/needing this feature for a long time. I take all of my Lynda.com training notes in Evernote and having to find new and creative ways to format the example code so that it stands out and is legible later on is frustrating to say the least. Really hoping they give this some serious consideration.

Link to comment
  • 1 month later...

Even if they didn't have syntax highlighting, some kind of code formatting would be nice. Even if it was as simple as you highlight a block of text, click a button, and it changes it all to a nice tabbed monospace font. You know. Like the code block feature that every forum everywhere, including this one, already has. Bonus points if it was collapsible. 

Link to comment
  • 2 weeks later...
  • Level 5*

It's kind of amusing to me that we've come to depend on syntax highlighting to make code understandable. Of course it's turned on in Visual Studio for me, but a pretty fair amount of code is published online in plain old black&white. Any developer needs to be able to read and understand just the plain text.In VS, I tend to look past the highlighting most of the time, except for commented areas.

 

In my experience, Evernote will retain syntax highlighting/formatting (modulo the spacing when tabbed) when clipped from a source that makes the highlighting available (VS, I'm pretty sure, but not NotePad++, or maybe it's vice-versa). Supporting better formatting would be far more useful, with respect to character spacing / tabs.

Link to comment

It's kind of amusing to me that we've come to depend on syntax highlig...

 

Personally I don't think any developer should, or has to, read unformatted code. Anything can be opened up in sublime text for a quick glimpse at whats going on or in the respective IDE and have the benefits of syntax highlighting, auto formating, code folding, etc. It's not really about making code understandable it's about making it more readable which means it's more intuitive to understand.

 

In notes especially it's much better to have a code block that differentiates it from plain text. Currently I paste snippets from mono and evernote retains the formatting but I can't then make ammendments in the same formatting. It's my understanding that they use html formating for notes anyway so it can't be hard to find a ready to use open source code block plugin.

Link to comment
  • Level 5*

My own opinion is that it's a poor coder who can't understand code presented in black and white (unformatted code is different from syntax-highlighted code, btw), but hey, I'm old school. Syntax highlighting is useful, sure, but it's not always available; do you really need to hoist out a code chunk from a web article (I clip a lot of software development articles) and drop it into Sublime/whatever to figure it out? And let's face it: natural language grammars are far more complicated than computer language grammars, yet we don't do syntax highlighting for literature, do we?

 

Use case for developers relative to non-developers is pretty small, I'd guess, and the Evernote folks don't seem particularly interested in this (or Markdown, or LaTex formulas, etc.) so I'd say that this won't make it any time soon. But you never know. This might be a case where a third-party developer steps in to supply the functionality, a la Markdown.

 

I find that I can usually edit code snippets in Evernote for WIndows, and it retains the formatting (typeface/size), though indentation can be a problem (I'll use indent/outdent if possible), and sometimes line spacing. Better text editing facilities in Evernote are always welcome, but Evernote is a general purpose text tool, and isn't well suited to doing code editing, at least anywhere near as well as a purpose-built code editor, so my expectations are pretty low there.

Link to comment

My own opinion is that it's a poor coder who can't unde...

 

I get your point and yea any developer shouldn't have a problem with plain text code for those fringe cases. There aren't many resources online I've come across worth reading that don't have some kind of formatting applied to code blocks though. When it comes to code I view syntax highlighting as part of formatting but that's just symantics. Sure, you can get by without but there's no real need to. And when you're trying to understand someones else code it helps to have key elements highlighted to speed things up or pick out certain types.

 

Reminds me of when I started out and people kept saying to use notepad because it would make me a better coder. Of course I ignored them and used a feature rich IDE and stuff like code completion really helped jog the memory (and still does).

 

Anyway, getting a bit off topic now. Maybe if evernote introduced a custom formatting block and let people define all the properties themelves it would have a wider appeal. For Instance you click a 'custom block' button or type something like [customblock] and you can set all the formatting and background colour. Or have custom preset formatting in a drop down.

 

Like you said, it's only meant for general text so can't expect too much.

Link to comment

@jefito I can't tell if you're still currently a programmer or not, but as someone that stares at code all day long in addition to writing technical notes and documentation, syntax highlighting gives me _way_ less eye strain. I'm fine writing out things in a monospaced font, which I have been, but the experience could be richer. if it's not something that Evernote sees as a viable option, then the only alternative I could suggest are some of these interesting options:

 

https://github.com/timlockridge/SublimeEvernote (ST2)

https://github.com/bordaigorl/sublime-evernote (ST3 fork of the above)

 

another interesting thing I've read about is an Evernote publishing platform (who knew?): http://postach.io/ 

 

and someone wrote an interesting article about syntax highlighting for it: http://writings.miguelregedor.com/syntax-highlighting-for-your-evernote-postach-io-blog

 

lastly, some of the random other suggestions you'd see out of Quora: https://www.quora.com/The-best-way-to-make-Evernote-support-Code-Syntax-Highlighting-and-Formatting

 

hope that gives guidance to everyone else until/if Evernote decides that syntax highlighting would be a viable option. I'm sure they'd want to cater to the engineers :)

Link to comment
  • Level 5*

@jefito I can't tell if you're still currently a programmer or not, but as someone that stares at code all day long in addition to writing technical notes and documentation, syntax highlighting gives me _way_ less eye strain. I'm fine writing out things in a monospaced font, which I have been, but the experience could be richer. if it's not something that Evernote sees as a viable option, then the only alternative I could suggest are some of these interesting options:

I am currently a full-time coder, as I have been for the last 31+ years. Yes, that means that I had a pretty fair amount of experience with mono coding environments, and a lot of code has passed under my eyes. Eyestrain hasn't been a problem for me, true confessions, though: I've used reading glasses for the past couple of years, but this is pretty natural given my age (I also read a lot of books). I'm guessing, based on the reasons given above, that Evernote's not all that interested in it, but I don't know for sure. For now, hopefully the 3rd-party options will fill the gap for those who want syntax highlighting.

 

Syntax highlighting is not about whether or not you can read/understand the code without highlighting.

It's about making it easier and faster to read, and probably with fewer "reading errors".

?? This is pretty incomprehensible, or at least circular. Isn't "understanding the code" intimately related to "making code easier to read"? Why would you read code if you didn't want to understand it? Is there a reference for whatever it is you're trying to assert here?

 

 

I'm sorry, but to me, syntax highlighting is mainly just frou-frou, and borderline distracting. Well-written (organized and well-formatted) code presented in mono is far easier to understand than ill-formatted, poorly organized code that's syntax highlighted. I can distinguish a string or a number by eye; I don't need them colored brown or whatever. And haven't I learned those C/C++ keywords by now? As I said before, about the most useful thing with syntax highlighting is different colors for live code and commented out code; I'd add live brace matching. I pretty much don't notice the rest of it. Visual Studio will tell me where syntax errors exist in my source code, right in the editor, live and without needing to go through a compile to get it, and that's far more valuable to me. If I need to know whether an identifier is a macro, global variable, method name, class name, etc., Visual Studio will tell me that pretty easily too.

 

So ok, there may be a case for someone learning a language. But consider this: if you don't know the syntax of the language that you're using cold, how are you going to be able to tell whether that blue highlighted thing is syntactically correct in the code sequence where it appears anyways?

 

Again, I put up the example of natural languages, which have far more complicated grammars than computer languages, and ask why we don't use syntax highlighting for that? Should nouns be blue (maybe bold-faced if plural), adjectives purple, verbs be red (darker is they're in the past, lighter if they're future, bold if they're perfect tense), etc? Natural languages are notoriously difficult to read unambiguously; how great would that syntax-highlighted prose be to read? Help or hurt?

 

This is all my opinion, though. I've done a bit of searching around, and there's a lot on how to set up or use syntax highlighting, but precious little on how it actually makes things better; it feels like it's there on a because-we-can basis. The searches I used were "is syntax highlighting useful?" is "is syntax highlighting distracting?"; one article definitely against syntax highlighting, a couple of topics reacting to that article. Maybe because I didn't use syntax-highlighting for a long time, I'm immune to its improvements. What did I miss?

Link to comment
  • Level 5*

Some people just don't get it.  They don't know how to view things from the perspective of others.

Some people don't read, period. And to counteract your passive-aggressive comment, you sure didn't read my post, which explicitly disclaims what I wrote as my opinion, based on my experience. I understand that other people like syntax highlighting. I just don't understand why. That's why I asked for input on what I've missed. I still haven't found much supporting syntax highlighting as being objectively better, except for a reference to one paper, buried in some conference proceedings that I can't get hold of without paying for it. I did find a study that claims that there's little or no improvement given by this facility, but I haven't read it yet.

 

It's an interesting question for someone who spends a lot of their life looking at a lot of code.

 

Meanwhile you've offered no kind of evidence or research supporting the claim that syntax highlighting makes code easier to read and understand. So what's your point? "Just because" isn't evidence, and it's not a reason. It's just your opinion, same as mine.

Link to comment

@jefito

 

I was going to go through your posts and comment on a few points but I really can't be bothered. You've posted on the forum of a note taking app about a feature you clearly have no interest in with the implication that people who need it are a bit slow in the head.

 

It really isn't a difficult concept to understand, some people find highlighting helpful (actually, quite a lot do) and some don't. You won't find many conclusive articles or papers, if any, regarding the impact of syntax highlighting because it's basically down to personal preference. And if your preference is none or very limited then a modern IDE can have custom highlighting setup or off altogether. You've said yourself that you find it useful for things like commenting so it can't be hard to see how others extend that thinking on to other elements.

 

Syntax highlighting allows me to quickly pick out key elements like methods, control statements and types regardless of how well the code has been put together. As a developer I'm sure you'll appreciate how much of the code you work with isn't always your own or too familiar or even that well presented at times. Having visual cues to help scan blocks of code can be handy and more productive. You don't get those types of instructions meant for machines in natural language which is why the analogy you're keen to press doesn't fit. Some IDEs are better than others but generally the default settings have a nice balance of what to highlight.

 

In the context of evernote it's just about having a formatting block that differentiates itself from other text and presents code in a familiar way. Since formatting tends to carry over from an IDE anyway I can see how the feature isn't really on the radar.

Link to comment
  • Level 5*

@mrSomebody:

 

True enough, syntax highlighting is minimally useful to me (as noted, comment highlighting; I'm not sure if live brace-matching counts, but that's useful, too), so it's a spectrum. I realized this when I was reading the topic, and took a step back and thought about how I use it, how it affects the code that I see and write nearly every day. I certainly have worked on a lot of code that originated from someone else, so I understand the dynamic.

 

Some people obviously feel that it's useful and it is certainly fine to ask for the feature. My own feeling is that it wouldn't have a broad enough audience to make it worth Evernote's while to implement it, but that's my opinion, and I hope I've made that plain. It doesn't mean that I don't want Evernote to implement it, by the way. Moreover, it's not that I think that people who feel a need for syntax highlighting are, as you say, "slow in the head"; I would claim, however, that a competent programmer ought to be able to decipher unhighlighted code without too much extra trouble (modulo its formatting and  organization): maybe they're mentally able to parse it more quickly, but that shouldn't change the ultimate level of understanding.

 

I did mention that I did a little casual digging on the utility of syntax highlighting, and what I found for actual research was pretty scant. Hardly any research that I could find, but I'd be willing to read more. Here's what I found:

 

* A blog article :  A Case against Syntax Highlighting. The author doesn't really like syntax highlighting. He also brings up a natural language counterexample (I found this article after I'd posted about this, btw), which was interesting to me -- some of his commenters didn't like it any more than you did. :) The comments to the article are mostly worth reading through, I think.

 

* A scholarly article: An Experiment on the Effects of Program Code Highlighting on Visual Search for Local Patterns. No finding of much, if any, improvement using syntax highlighting as far as I can tell, but I haven't finished reading it yet. Small sample size, too, for what it's worth. They did note something that I had been about to post, but figured that was a little too pedantic for this discussion: that what we call syntax highlighting is actually just token highlighting; real syntax highlighting would somehow bring highlighting the rules that comprise a language's syntax. But common usage is "syntax highlighting", and a rose is a rose is a rose, so I let that be. The syntax checker that works behind the scenes in Visual Studio is far more useful to me than syntax highlighting, I've found.

 

*  An article in a symposium proceedings: Evaluating a Coulour Coding Programming Support Tool . Couldn't find the entire article without needing to pay for it, so didn't follow it up.

 

I still haven't figured out how the natural language example wouldn't apply to this case. If syntax highlighting can help us to understand a set of simpler languages better (the programming languages), why wouldn't it help with more complex languages?

 

I'd allow that some languages by benefit more from this feature, for example the ??MLs of this world, which are debatably programming languages -- they're markup languages; these mix content with the language structures, and keeping those separate via highlighting could be useful.

 

Software development environments are rich, powerful and complicated tools that can really help productivity. I'm certainly not averse to using facilities that help me to be more productive. But I've found that syntax highlighting doesn't do it for me; your mileage may vary, and you're welcome to advocate for the tools you want.

 
Link to comment
  • Level 5*

Until Evernote adds this feature, here's a possible work-around from another thread:

 

 

I have a good solution to this that's cross platform.

 

Get yourself a copy of sublime text. (Other editors might be able to handle this too). Then install the package called sublimehighlight.  

 

Now, simply paste your snippet into sublime, set the appropriate language in sublime, reindent, and highlight, copy, paste into Evernote. I use the rich text option. Simple pimple. I just notice it has a setting to do line numbers too, but this would be a hassle if you want to copy and paste it out of EN. Sure it's not perfect, but compared to anything else including evercode http://vimeo.com/45097420 this is better IMO.

 

EN is very unlikely to add this feature anytime soon. Heck they can't even make tables work properly. If you're pasting from an IDE like Visual Studio or Xcode or one of the Jetbrains brilliant IDEs it should put rich text on the clipboard for pasting into EN anyway. So it shouldn't be an issue. The other thing I would say is if you're copying this highlighted code from EN into a text editor it's a good idea to use something to strip out any extraneous junk. I have never run into any issues myself. I have shortcut key setup that just strips out all text formatting on a paste and use that. I have alfred do this on my Mac but there are many options for doing this on any platform.

 
Link to comment
  • 1 month later...
  • Level 5*

EN Mac 6.0.3+ Appears to Support Syntax Highlighting

 

I don't know if this works for other code editors, but EN Mac 6.0.3 maintains the font, format (including indents), and syntax colors of code pasted from AppleScript.  It did NOT work in Ver 5.5.2, but I have now done a copy/paste from AppleScript that works very well with Ver 6.0.3.

Link to comment
  • Level 5*

If it doesn't highlight your code as you type it, then it's not syntax highlighting, which is rendering according to a particular language's grammar rules. This just sounds like format preservation. I can get that behavior today, pasting from Visual Studio on Windows (I get the formatting because we indent using spaces, not tabs, but that's secondary to syntax highlighting), and have been able to do so for awhile, because VS puts code on the clipboard in rich text format, which Evernote can make use of. That useful enough sometimes, but it ain't syntax highlighting.

 

http://en.wikipedia.org/wiki/Syntax_highlighting

Link to comment
  • 2 weeks later...

Yes, please, add an ability to format code in Evernote.  I don't care if it is in some advanced menu that takes multiple clicks to get to.  Just make it possible!  Language-specific formatting would be amazing, but I could live with just a monospaced font and a box around it.

Link to comment
  • 3 weeks later...

My own opinion is that it's a poor coder who can't understand code presented in black and white

So what? It's probably the poor coder who needs to take notes the most. Why do I need to takes notes on things I already understand completely?

 

I've been using Evernote for a while, but maybe I don't understand what Evernote is supposed to be used for.

Link to comment

 

My own opinion is that it's a poor coder who can't understand code presented in black and white

So what? It's probably the poor coder who needs to take notes the most. Why do I need to takes notes on things I already understand completely?

 

I've been using Evernote for a while, but maybe I don't understand what Evernote is supposed to be used for.

 

 

Some of the best programmers I know have tons of notes and snippets stored up. The reason they're good is not just experience but having that resource to hand without having to trawl the internet for possible answers or starting from scratch. I'd actually go as far to say that thinking you know everything and not making notes is counter productive in the long run and makes you less effective. It's impossible for even the brightest minds to know everything about all the technologies that you come across when coding. 

 

My code notebook is mainly used to store handy snippets or technical notes relating to techniques, code, or technologies I may not use often or just find easier to have readily available notes for. Generally I'll know roughly where to look and the notes will provide the clarity I need without wasting too much time.

 

All I really want is basic code block formatting like you see on nearly every forum, including this one!

Link to comment

 

 

My own opinion is that it's a poor coder who can't understand code presented in black and white

So what? It's probably the poor coder who needs to take notes the most. Why do I need to takes notes on things I already understand completely?

 

I've been using Evernote for a while, but maybe I don't understand what Evernote is supposed to be used for.

 

 

Some of the best programmers I know have tons of notes and snippets stored up. The reason they're good is not just experience but having that resource to hand without having to trawl the internet for possible answers or starting from scratch. I'd actually go as far to say that thinking you know everything and not making notes is counter productive in the long run and makes you less effective. It's impossible for even the brightest minds to know everything about all the technologies that you come across when coding. 

 

My code notebook is mainly used to store handy snippets or technical notes relating to techniques, code, or technologies I may not use often or just find easier to have readily available notes for. Generally I'll know roughly where to look and the notes will provide the clarity I need without wasting too much time.

 

All I really want is basic code block formatting like you see on nearly every forum, including this one!

 

I definitely agree with mrSomeBody. Note taking and style is what helps the user reference his own material. Notes are personal. This has nothing to do with what others think is best. It pretty much comes down to whatever works for the individual. So, if syntax highlighting and code blocks / markup is what helps the user understand his/her notes, there is absolutely nothing wrong with that. I hope to see such implementation in the future.

Link to comment
  • 3 months later...

+1 - this is probably 90% of my use case. Take notes - share with my team... repeat.

 

Basically, this platform would be perfect for my needs if it did that, but it's useless without as it takes about 6 clicks / setting changes just to jump into a code block. (Monospace / smaller font is key for me when I say 'code block'.)

Link to comment

@jefito - (Off Topic) Well meant(?) but tl;dr. I find that a lot of verbiage and deserving of another topic/forum/site. As this comment may be.

 

+1 - I would personally very much like this feature in evernote. If this counts as a vote then i hope that it helps persuade the evernote team to consider implementing.  

 

As an alternative:

 

This is not intended to be an advertisement but I did a search for "code highlighting" in the evernote app centre and found marxico.

 

The site is http://marxi.co. It describes itself as a dedicated markdown editor for evernote.

 

Thats my two-penneth.

Link to comment

I too have been wanting this for a really long time, just tried this app called quiver and it seems very promising... its basically what evernote should have done.  I also like the idea of keeping my work stuff separate from my Evernote stuff, which now that I can store documents on has basically become a digital filing cabinet. 

Link to comment
  • 3 weeks later...

+1

Also using Quiver here, but would loooove to have the relevant syntax highlighting features rolled into Evernote, so I can have all of my notes back in one place.  I keep lots of reuseable code snippets, project notes, ideas, etc.

Link to comment
  • 4 weeks later...
  • 2 weeks later...
  • 4 weeks later...

 

@jefito I can't tell if you're still currently a programmer or not, but as someone that stares at code all day long in addition to writing technical notes and documentation, syntax highlighting gives me _way_ less eye strain. I'm fine writing out things in a monospaced font, which I have been, but the experience could be richer. if it's not something that Evernote sees as a viable option, then the only alternative I could suggest are some of these interesting options:

I am currently a full-time coder, as I have been for the last 31+ years. Yes, that means that I had a pretty fair amount of experience with mono coding environments, and a lot of code has passed under my eyes. Eyestrain hasn't been a problem for me, true confessions, though: I've used reading glasses for the past couple of years, but this is pretty natural given my age (I also read a lot of books). I'm guessing, based on the reasons given above, that Evernote's not all that interested in it, but I don't know for sure. For now, hopefully the 3rd-party options will fill the gap for those who want syntax highlighting.

 

Syntax highlighting is not about whether or not you can read/understand the code without highlighting.

It's about making it easier and faster to read, and probably with fewer "reading errors".

?? This is pretty incomprehensible, or at least circular. Isn't "understanding the code" intimately related to "making code easier to read"? Why would you read code if you didn't want to understand it? Is there a reference for whatever it is you're trying to assert here?

 

 

I'm sorry, but to me, syntax highlighting is mainly just frou-frou, and borderline distracting. Well-written (organized and well-formatted) code presented in mono is far easier to understand than ill-formatted, poorly organized code that's syntax highlighted. I can distinguish a string or a number by eye; I don't need them colored brown or whatever. And haven't I learned those C/C++ keywords by now? As I said before, about the most useful thing with syntax highlighting is different colors for live code and commented out code; I'd add live brace matching. I pretty much don't notice the rest of it. Visual Studio will tell me where syntax errors exist in my source code, right in the editor, live and without needing to go through a compile to get it, and that's far more valuable to me. If I need to know whether an identifier is a macro, global variable, method name, class name, etc., Visual Studio will tell me that pretty easily too.

 

So ok, there may be a case for someone learning a language. But consider this: if you don't know the syntax of the language that you're using cold, how are you going to be able to tell whether that blue highlighted thing is syntactically correct in the code sequence where it appears anyways?

 

Again, I put up the example of natural languages, which have far more complicated grammars than computer languages, and ask why we don't use syntax highlighting for that? Should nouns be blue (maybe bold-faced if plural), adjectives purple, verbs be red (darker is they're in the past, lighter if they're future, bold if they're perfect tense), etc? Natural languages are notoriously difficult to read unambiguously; how great would that syntax-highlighted prose be to read? Help or hurt?

 

This is all my opinion, though. I've done a bit of searching around, and there's a lot on how to set up or use syntax highlighting, but precious little on how it actually makes things better; it feels like it's there on a because-we-can basis. The searches I used were "is syntax highlighting useful?" is "is syntax highlighting distracting?"; one article definitely against syntax highlighting, a couple of topics reacting to that article. Maybe because I didn't use syntax-highlighting for a long time, I'm immune to its improvements. What did I miss?

 

 

Well my great grandfather never liked color television, but hey to each his own.

Link to comment
  • 2 months later...
  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...