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

feat: convert native HTML line breaks <br> to Markdown line breaks #576

Closed
spudart opened this issue Jan 8, 2024 · 5 comments
Closed

feat: convert native HTML line breaks <br> to Markdown line breaks #576

spudart opened this issue Jan 8, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@spudart
Copy link

spudart commented Jan 8, 2024

Thank you so much for making such a great tool to export notes from Evernote to Markdown for Obsidian.

I've noticed that Yarle is not converting <br> tags in my CDATA.

Here is an enex file with one test note:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export3.dtd">
<en-export export-date="20240108T214207Z" application="Evernote" version="Evernote Mac 7.14 (458265)">
<note><title>Note with line breaks</title><content><![CDATA[<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note>
Line 1<br></br>
Line 2<br>
Line 3<br/>
Line 4<br />
Line 5<br clear="none"/>
Line 6<p></p>
<p>Line 7</p>
<div>Line 8<br></br></div>
<div>Line 9<br></div>
<div>Line 10<br/></div>
<div>Line 11<br /></div>
<div>Line 12<br clear="none"/></div>
<div>Line 13<p></p></div>
<div><p>Line 14</p></div>
<div>Line 15</div>
<div>Line 16</div>
</en-note>]]></content><created>20240108T214113Z</created><updated>20240108T214144Z</updated><tag>test2</tag><tag>test1</tag><note-attributes><latitude>41.87312697527578</latitude><longitude>-88.07482909555657</longitude><altitude>0</altitude><author>Matt Maldre</author><source>desktop.mac</source><reminder-order>0</reminder-order></note-attributes></note>
</en-export>

Yarle is outputting this:

Line 1Line 2Line 3Line 4Line 5Line 6

Line 7

Line 8
Line 9
Line 10
Line 11
Line 12
Line 13

Line 14

Line 15
Line 16

Whereas it would be fantastic if Yarle generated this instead:

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6

Line 7

Line 8
Line 9
Line 10
Line 11
Line 12
Line 13

Line 14

Line 15
Line 16

Am I missing something that the <br> tags in my notes are not being converted to line breaks?

Copy link

github-actions bot commented Jan 8, 2024

Yihaa, thank you for reporting me this issue and to let me improve Yarle!

@akosbalasko
Copy link
Owner

Hi @spudart ,

Thanks for the details and the enex file! I think it is because Evernote stores newline-ish looklike differently, not as plain
tag.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd">
<en-export export-date="20240108T223036Z" application="Evernote" version="10.68.3">
  <note>
    <title>newlines</title>
    <created>20240108T223014Z</created>
    <updated>20240108T223024Z</updated>
    <note-attributes>
    </note-attributes>
    <content>
      <![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note><div>line1</div><div>line2</div><div><br/></div></en-note>      ]]>
    </content>
  </note>
</en-export>

So in this case the div tags separate the content like newlines in html, hence
is being removed, as it encapsulated by an other div.
But anyway, if you think it's meaningful, I'm happy to introduce a new config option named "Convert newline HTML tags" to produce the desired behavior.

ccc

@akosbalasko akosbalasko added the enhancement New feature or request label Jan 8, 2024
@akosbalasko akosbalasko changed the title HTML line breaks <br> not converted to Markdown line breaks feat: convert native HTML line breaks <br> to Markdown line breaks Jan 8, 2024
@spudart
Copy link
Author

spudart commented Jan 8, 2024

@akosbalasko The config option "Convert newline HTML tags" would be incredible! Thank you!

@akosbalasko
Copy link
Owner

akosbalasko commented Jan 9, 2024

hi @spudart ,
technically in the provided enex is converted like as follows becase there is
in each line between line 8 and line 12, then newlines are going to be converted because

from the upcoming lines.
So, this is what we have now, if "convert Plain html newlines" is ticked:


Line 1
Line 2
Line 3
Line 4
Line 5
Line 6

Line 7

Line 8

Line 9

Line 10

Line 11

Line 12

Line 13

Line 14

Line 15
Line 16

@akosbalasko
Copy link
Owner

Released in version 6.3.0

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

No branches or pull requests

2 participants