Jump to content
  • 3

Code Block Formatting


penguinairlines

Idea

Hello,

Please consider updating the font or functionality of Code Blocks.  When I paste content into these, it may sometimes keep the formatting and may sometimes (always when pasting matching formatting) paste in 'Monaco', which is a font that is not available for selection on Evernote Windows app OR Evernote web app.  There are plenty of unicode options available that are more common to use that could be recognized in multiple applications.  

Alternatively, you could add support for Monaco font in Windows app.  A "Copy Format" tool would be very handy as well, which is surprising to see missing from the full app, as even free open-source text editors have this feature.

 

Please let me know if you think there is a solution that I am missing,

-PA

Link to comment

10 replies to this idea

Recommended Posts

I strongly support the suggestion of switching fonts or installing Monaco when Evernote is installed.

The lack of the Monaco font prevents pasting code into code blocks, without subsequently reapplying a monospaced font, which sort of defeats the point of the feature; I rarely write the code in Evernote itself.

Workaround: Monaco can be downloaded for free from various sources. *edit* By installing it as a system-wide font, the broken behaviour of Evernote code blocks can be fixed, but it really should work out of the box. Tested only on Windows 10.

Link to comment
  • Level 5*
2 hours ago, Klaus said:

The lack of the Monaco font prevents pasting code into code blocks, without subsequently reapplying a monospaced font, which sort of defeats the point of the feature; I rarely write the code in Evernote itself.

Not everyone who uses code blocks uses the Monaco typeface. I tend to use Consolas in my development environment, which has been distributed with Windows since Vista, though I've used the freely available Inconsolata before, too, among others. There's no need for Evernote to download particular fonts for this purpose, since those who want to use then probably already have them installed, and also because most people aren't developers and probably don't use code blocks anyways.

In any case, I would support making the typeface/size used by code blocks a user-configurable setting. That way, if you want to use Monaco, you can. And further (as I think this is something that you're saying here), enforcement of the single typeface used in a code block (so that you don't get variable-spaced fonts in your nice neat code block when you paste into it) would be helpful, too.

Link to comment
17 hours ago, Klaus said:

I strongly support the suggestion of switching fonts or installing Monaco when Evernote is installed.

...

Workaround: Monaco can be downloaded for free from various sources.

Assuming that you've read my whole post, which I re-read to make sure that I included all relevant information, please explain to me how I can install Monaco font to the Evernote web application.  

Link to comment
6 hours ago, penguinairlines said:

Assuming that you've read my whole post, which I re-read to make sure that I included all relevant information, please explain to me how I can install Monaco font to the Evernote web application.  

By installing it system-wide. (Worked on Windows).

21 hours ago, jefito said:

Not everyone who uses code blocks uses the Monaco typeface. [...] There's no need for Evernote to download particular fonts for this purpose, since those who want to use then probably already have them installed, and also because most people aren't developers and probably don't use code blocks anyways.

In any case, I would support making the typeface/size used by code blocks a user-configurable setting. [...]

Full agreement actually. It is just, that (at least on Windows), Evernote uses Monaco as the default font for code blocks and doesn't make it user-configurable.

As a consequence, code blocks exhibit broken behaviour out of the box.

And even if they make the font user-configurable, the default one should actually be available on the system without further user interaction.

Link to comment
  • Level 5*
4 hours ago, Klaus said:

Full agreement actually. It is just, that (at least on Windows), Evernote uses Monaco as the default font for code blocks and doesn't make it user-configurable.

As a consequence, code blocks exhibit broken behaviour out of the box.

And even if they make the font user-configurable, the default one should actually be available on the system without further user interaction.

Well interesting -- I tried this on my work computer, but maybe just pasted in something from Visual Studio and god Consolas.

In any case, it's not clear where the Monaco in the list is coming from; I don't have it installed on my machine here at home.  Given the generated markup from an exported note (see below), you can see that Monaco is one of a set of alternative monospaced typefaces used to represent code blocks, and because it's the first in that list of alternatives, it's picked up there and  appears in the typeface dropdown. A bit confusing, but I guess it's harmless. I think that the idea is that a ode blockl be displayed as monospaced even if Monaco's not available; it'll just use Consolas or something else, depending on your OS,, reason being that you might create a code block on one OS, but be viewing it on another.

Excerpt from an exported note that has some normal text, subscript, superscript, and then a code block.

<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">

<en-note><div>Text styles</div><div><br clear="none"/></div><div>normal</div><div><span style="vertical-align: sub;">subscript</span></div>
  <div><span style="vertical-align: super;">superscript</span></div><div><br clear="none"/></div>
  <div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;">
    <div>In a code block</div>
  </div>
  <div><br/></div></en-note>]]

 

Link to comment
4 minutes ago, jefito said:

Well interesting -- I tried this on my work computer, but maybe just pasted in something from Visual Studio and god Consolas.

In any case, it's not clear where the Monaco in the list is coming from; I don't have it installed on my machine here at home.  Given the generated markup from an exported note (see below), you can see that Monaco is one of a set of alternative monospaced typefaces used to represent code blocks, and because it's the first in that list of alternatives, it's picked up there and  appears in the typeface dropdown. A bit confusing, but I guess it's harmless. I think that the idea is that a ode blockl be displayed as monospaced even if Monaco's not available; it'll just use Consolas or something else, depending on your OS,, reason being that you might create a code block on one OS, but be viewing it on another.

 

Could you try pasting some source code from a non-rich-text environment to a code block? If nothing else is available, pasting some source code to notepad and then copying it from there should strip the information. (In real world usage it would be something like Emacs or TeXStudio).

For me, when pasting such code into a code block, Evernote would display it as a not-monospaced font, and I would have to apply a monospaced hand over and over again manually. Your explanation seems to be basically the reason, why applying the Monaco font worked, despite it not actually being available. As for why it wasn't applied when pasting plain-text, that seems to be a more fundamental bug that goes beyond the choice of the default font.

Link to comment
  • Level 5*
1 hour ago, Klaus said:

Could you try pasting some source code from a non-rich-text environment to a code block? If nothing else is available, pasting some source code to notepad and then copying it from there should strip the information. (In real world usage it would be something like Emacs or TeXStudio).

In my example, I just opened up a new code block and typed some text in, and got monospaced text.

If I paste in from Notepad++, which should be plain text (and verified that it's only plain text on the clipboard,), I get a non-monospaced font. That's weird. I'd call it a bug.

 

Link to comment

I'd love to see some control over the code block style. I use DejaVu Sans Mono and have a particular code block style in EN that I've adopted for years in the absence of any useful style controls. I've got used to wading through the font dialogue box multiple times to do this.

The code block feature would be very useful to me if only it had some definition controls. It's completely useless to me as it is unfortunately.

Link to comment

I've been working with newer versions of EN since the recent security update, and the Code Block function is one of the items I've seen changed in the newer versions I'm now using.

I liked being able to indent the Code Block function, for example.  I, too, would like to see some font control.

For my use, I wouldn't say it's useless otherwise without the definition controls, but it does *****/limit significantly my note formatting, and I don't like that at all.

This is one of those things that worked a little differently in earlier versions, so I'd like to see the function return and be developed a bit more.

Link to comment

Archived

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

×
×
  • Create New...