-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Desktop,Cli: enex_to_md: support bold formatting in span tags #1708
Conversation
Answering all these questions is hard and as you found out there are lots of edge cases to handle, which is why it has never been implemented. This is the kind of feature that's all or nothing - either it works in all cases, or we simply don't include it (it's better to have non-formatted text than one with broken format). The best approach I think would be to do it one step at a time: write a few tests (in the EnexToMd test unit) and confirm that with your changes they pass, and that other features have not been broken. Start with one narrow case and build on that, maybe over several PR. |
a5028c5
to
8b96ff3
Compare
Hi Laurent, how are you handling this? are you on an operating system that doesn't save newlines as the last character (eg. windows doesn't i think). Sorry I did some force pushing to this branch already but I think this is not a problem for the PR. I am planning on removing some features, adding the proper tests and rebase everything to one nice commit. Therefore I'd need to force push to my branch again. |
I could fix the newline at end of file troubles with a vim setting. in case anybody is interested:
prior to saving the file or just put it into .vimrc |
* one pair for basic text formatting tags: strong, b, i, em * and one using span tags with inline styles for bold formatting Note: The html files include the Evernote-typical "linebreak tags inside of separate <div> tags" to represent empty lines!
* function isSpanWithStyle() checks if further processing of a span tag makes sense * function isSpanStyleBold() checks if bold formatting via styles is used - a similar function could be written for each span-inline-style-format that should be supported
Hi @laurent22
Hope you like it or suggest what could be improved :-) |
pushing attributes of span tag to state object now happens outside of isSpanWithStyle()
Thanks @JOJ0! Hard to tell if it will work in all cases but I can see it seems fine with my old Evernote notes and your tests are good too, so let's merge. |
Hi Laurent, thanks a lot for testing and merging! I also did a lot of tests with my evernote notes and it seems good, except the cases with leading and trailing spaces I mentioned. But that's the same with the regular bold, italics and so on tags. I guess this will be a rather tricky one to fix. Thanks again and all the best! |
Hi, I added a draft feature to detect some styles buried inside of span tags. Evernote did that very often to my notes. E.g. most of my bold text was saved as inline styles in span tags and not as
<b>
or<strong>
tags. This feature is far from perfect but I wanted to discuss things further before moving on. I read the contribution guidelines and tried to follow them but I didn't write a unit test yet. I will if it is necessary.I am aware of the following issues:
<div><span style="font-weight: bold;">text bold blabla, </span>text normal blabla </div>
it produces markdown that is not correct, because there is a space missing after the closing **:
**text bold blabla, **text normal blabla
this could happen with normal
<strong>
tag too. how did you handle it?Please tell me which fixes/features you'd like to see to accept this.
Thanks a lot
Jojo