Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any note submission or update returns "Illegal to contain comments in ENML" #219

Open
alexcthompson opened this issue Aug 6, 2021 · 17 comments

Comments

@alexcthompson
Copy link

If I send a new note to Evernote, or I update an existing note, I get the error below. My guess is that the comment it is referring to is:

<!-- Sublime:LS0tCnRpdGxlOiB0ZXN0Cm5vdGVib29rOiBBUkNISVZFCnRhZ3M6Ci0tLQoKCgo=-->

?

This repo seems pretty inactive so I don't know if many people are using the plugin still? I love the plugin, TY for creating it! But if it is inactive, I'll find a new option.

Evernote: []
Evernote: Using cached notebooks list
Evernote: test
Evernote: []
Evernote: 056ef419-fb0c-441d-b086-cd06c29bc14e
Evernote: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note>
<!-- Sublime:LS0tCnRpdGxlOiB0ZXN0Cm5vdGVib29rOiBBUkNISVZFCnRhZ3M6Ci0tLQoKCgo=-->
<p></p>
</en-note>
Evernote error: [Enml validation]
	Illegal to contain comments in ENML
	Last command: insert_completion {'keep_prefix': False, 'format': 'snippet', 'must_insert': True, 'completion': 'ARCHIVE', 'trigger': 'ARCHIVE'}
@rubslopes
Copy link

Came here for the same problem. I also hope this can be fixed, I love the plugin and use it daily!

@alexcthompson
Copy link
Author

If I had to guess, Evernote updated the ENML spec to exclude XML comments (but I can't find any evidence of this in the docs.) A cursory look at the Python code makes me think this comment contains coded metadata, but I'm unfamiliar with this stuff. A fix would have to start pushing a different kind of XML tag instead, and then maintain two branches of code for decoding metadata tags: one tag for the current format and one for the new format.

But I have no idea if that is correct!

@qunwang6
Copy link

qunwang6 commented Aug 8, 2021

+1

@bordaigorl
Copy link
Owner

Hi, yes the plugin is not actively developed, although, if I can I would provide small patches to keep it working.
I concur with the analysis of @alexcthompson it looks like they changed the validation of the internal format to reject comments.
The plugin is using comments to store the markdown version of the note.
This was great for ergonomics but relied on some undocumented behaviour of Evernote clients (e.g. that updates in other clients removed comments).
When such comment is not found the plugin's back-conversion from XML to markdown is used, but that gives less reliable results, especially with the more recent changes they made.
One super annoying thing is that it is very difficult to get a reliable result in all clients, the format is not very well specified and ambiguous. Moreover, the official clients themselves seem to be very idiosincratic in the format: many new features like tasks are encoded using non-documented styling instead of updating the XML schema, which makes it impossible to provide alternative reliable clients.
Another obstacle: they never really released a SDK for Python 3 (only Python 2). Even after Python 2's end of life, they kept the old obsolete SDK. The one for Python 3 is experimental and there's no hope that they put any serious effort in it.

Overall, this and other considerations pushed me away from their platform.
I now just use plain markdown files that are synced across my devices.

So, to cut a long story short, a quick workaround for now would be to disable the output of the comment in the plugin (I can provide a patch for that) but that would probably impact how well the plugin would work for you.
The "sturdy" solution would be to move the functionality that was implemented through that comment, into the applicationData map of ResourceAttributes.
Quoting from the docs:

applicationData
Provides a location for applications to store a relatively small (4kb) blob of data associated with a Resource that is not visible to the user and that is opaque to the Evernote service. A single application may use at most one entry in this map, using its API consumer key as the map key. See the documentation for LazyMap for a description of when the actual map values are returned by the service.

To safely add or modify your application's entry in the map, use NoteStore.setResourceApplicationDataEntry. To safely remove your application's entry from the map, use NoteStore.unsetResourceApplicationDataEntry.

The 4KB limit would clearly be a limitation, plus I don't really know if you need to first register with them the plugin as an official application (which I doubt they would do).

Another possibility would be to include the markdown as an attachment, but that would add visible cruft (it can also be confusing since changing the note from other clients would make the attachment outdated).

@axfelix
Copy link

axfelix commented Aug 8, 2021

I also still use and love this plugin, but I know it's not actively developed anymore, so if this is the last straw, I understand -- I've been starting to use obsidian.md more often lately too. Thank you for supporting this as long as you have!

@dbrits17
Copy link

dbrits17 commented Aug 9, 2021

I've been using this plugin daily for the last three years. I've used it to sync thousands of notes, and it's the primary means of how I keep organized. I'd hate to see this be the end of it, but if it is - well, it's been an amazing run.

@rubslopes
Copy link

For those thinking about moving, let me suggest Obsidian.md. You can use the app to organize, view and export the notes, and continue using Sublime to edit the markdown files as we are all used to.
Obsidian also has tons of useful plugins, and you can store all the files locally.

Thank you @bordaigorl for the great work!

@dbrits17
Copy link

dbrits17 commented Aug 9, 2021

For those thinking about moving, let me suggest Obsidian.md. You can use the app to organize, view and export the notes, and continue using Sublime to edit the markdown files as we are all used to.
Obsidian also has tons of useful plugins, and you can store all the files locally.

Thank you @bordaigorl for the great work!

I've spent the last twenty minutes researching Obsidian. Thanks for the tip, @axfelix and @rubslopes . It looks like I'll be migrating to Obsidian.md this weekend.

@qunwang6
Copy link

Now it can be used normally .

@qunwang6
Copy link

The error appeared again.

@alexcthompson
Copy link
Author

Same here, the error is back.

@Strangehill
Copy link

Thank you, @bordaigorl . I've appreciated your efforts with this plugin for many years and it has been essential in many of my workflows in my school, work, and personal life. Ultimately, Evernote should have made markdown a native feature. On top of repeatedly breaking the community's best workarounds, the fact that they haven't yet in 2021 made markdown a native feature in, prevents me from investing any more of my life's work into Evernote.

@rdhyee
Copy link

rdhyee commented Sep 6, 2021

I submitted a ticket to Evernote (#3377492) to see whether I can get someone inside Evernote to consider reversing this behavior, to allow once again comments in ENML. Tweeting at EvernoteHelp didn't work (https://twitter.com/rdhyee/status/1428448392099688448).

@blackerhand
Copy link

Waiting the patch

@shengwuyang
Copy link

Hi, yes the plugin is not actively developed, although, if I can I would provide small patches to keep it working. I concur with the analysis of @alexcthompson it looks like they changed the validation of the internal format to reject comments. The plugin is using comments to store the markdown version of the note. This was great for ergonomics but relied on some undocumented behaviour of Evernote clients (e.g. that updates in other clients removed comments). When such comment is not found the plugin's back-conversion from XML to markdown is used, but that gives less reliable results, especially with the more recent changes they made. One super annoying thing is that it is very difficult to get a reliable result in all clients, the format is not very well specified and ambiguous. Moreover, the official clients themselves seem to be very idiosincratic in the format: many new features like tasks are encoded using non-documented styling instead of updating the XML schema, which makes it impossible to provide alternative reliable clients. Another obstacle: they never really released a SDK for Python 3 (only Python 2). Even after Python 2's end of life, they kept the old obsolete SDK. The one for Python 3 is experimental and there's no hope that they put any serious effort in it.

Overall, this and other considerations pushed me away from their platform. I now just use plain markdown files that are synced across my devices.

So, to cut a long story short, a quick workaround for now would be to disable the output of the comment in the plugin (I can provide a patch for that) but that would probably impact how well the plugin would work for you. The "sturdy" solution would be to move the functionality that was implemented through that comment, into the applicationData map of ResourceAttributes. Quoting from the docs:

applicationData
Provides a location for applications to store a relatively small (4kb) blob of data associated with a Resource that is not visible to the user and that is opaque to the Evernote service. A single application may use at most one entry in this map, using its API consumer key as the map key. See the documentation for LazyMap for a description of when the actual map values are returned by the service.
To safely add or modify your application's entry in the map, use NoteStore.setResourceApplicationDataEntry. To safely remove your application's entry from the map, use NoteStore.unsetResourceApplicationDataEntry.

The 4KB limit would clearly be a limitation, plus I don't really know if you need to first register with them the plugin as an official application (which I doubt they would do).

Another possibility would be to include the markdown as an attachment, but that would add visible cruft (it can also be confusing since changing the note from other clients would make the attachment outdated).

@bordaigorl Can you provide the patch? I still encounter this issue now.

@bordaigorl
Copy link
Owner

Should be fixed now @shengwuyang @blackerhand @rdhyee

@shengwuyang
Copy link

It works. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants