bordaigorl / sublime-evernote

Open and Save Evernote notes from Sublime Text 3 using Markdown
Other
1.15k stars 106 forks source link

Error msg: 'div' html tag with 'markdown' attribute #207

Open theandychung opened 5 years ago

theandychung commented 5 years ago

I clipped a webpage to evernote and open it in sublime text 3 using this package. I found this package is not able to update my note back to evernote if my note has more than 5 layers of div. The error msg i get is the following:

Evernote Complained: The contents of the note are not valid. The note contains a 'div' HTML tag with a 'markdown' attribute; this is not allowed in a note.

Retry?

Here is a sample code I made:

<div markdown="1" style="-evernote-webclip: true;">
<div markdown="1" style="font-size: 16px; display: inline-block;">
<div markdown="1" style="font-size: 16px; display: inline-block;">
<div markdown="1" style="font-size: 16px; display: inline-block;">
<div markdown="1" style="font-size: 16px; display: inline-block;">
xxxx

</div>
</div>
</div>
</div>
</div>

I noticed that the similar extension in vscode, evermonkey, doesn't add markdown="1" when pulling the notes from evernote server, and it doesn't have any problem uploading the note back to evernote. I wonder if disabling automatically adding these markdown attributes could solve this issue.

Thank you for making this wonderful package for us.

nonbeing commented 5 years ago

I'm getting the same error.

And yes, editing and publishing the same note in VS Code's "evermonkey" extension works fine without any errors. This used to work fine a while ago (more than a year ago when I last used sublime-evernote, so I guess the API or something's changed since then and this extension needs to be updated.

bordaigorl commented 5 years ago

THanks for reporting this issue! I looked into this. The problem is twofold:

  1. the Evernote format keeps changing without documentation and inconsistently across clients.
  2. the markdown converter we use in this plugin is crap.

Fixing 2 seems trivial but is not as the conversion needs to be heavily customised to be compatible with Evernote's restrictions on the notes content.

I am going to push a patch that should help with these cases. I need your help with testing. And there's no guarantee it works in all cases and that it will work in the future.

bordaigorl commented 5 years ago

@theandychung @nonbeing I would be very grateful if you could install the new-codeblocks branch and test it with your workflow to see if the problems are solved.

theandychung commented 5 years ago

I can't upgrade the package through package control, do I need to upgrade it manually?

oops, accidentally closed this lol

bordaigorl commented 5 years ago

@theandychung yes you need to do this manually (I'm not updating the master version without testing 😉 ) One way would be to replace the package in sublimetext by cloning the new-codeblocks branch in the Packages/Evernote directory. You can put the old version back when you are done or just switch to the master branch (but then you would need to pull to update the repo instead of relying on package control).

theandychung commented 5 years ago

It's the same. The website I'm having problem is this one.

bordaigorl commented 5 years ago

@theandychung could you please give some more details? I need:

  1. which platform you are using (os, browser, evernote client)
  2. what actions you take: what do you do with the webclipper? Save selection? The whole page?
  3. what you expect to happen when you open a webclip from sublime text
  4. what you expect to happen when you edit and save a webclip from sublime text
  5. what happens instead.

Thanks

bordaigorl commented 5 years ago

I did some tests on the page you linked. It turns out a different problem was kicking in: the webclipper is inlining styles, including fonts and delimiting font names with &quot;. That caused the plugin to first turn these into " upon conversion and then getting confused because of non matching " in the attributes of the divs. I just pushed a patch in new-codeblocks, try pull and test again.

theandychung commented 5 years ago

Sorry, I should have made it more clear. I used webclipper to clip a section of the page, then open it in the sublime text 3, then trying to update the note. The new patch didn't work for me.

bordaigorl commented 5 years ago

@theandychung Can you explain what went wrong?

theandychung commented 5 years ago

The error msg I mentioned at the beginning pops out whenever I want to update the note back to evernote (even if I didn't edit anything). I wonder if this is an unexpected behavior.