diff --git a/packages/app-cli/tests/enex_to_md/ImportTestCorrupt.enex b/packages/app-cli/tests/enex_to_md/ImportTestCorrupt.enex index e60513266..6c256d14a 100755 --- a/packages/app-cli/tests/enex_to_md/ImportTestCorrupt.enex +++ b/packages/app-cli/tests/enex_to_md/ImportTestCorrupt.enex @@ -7,7 +7,7 @@
Plain note
]]>20201223T163948Z20201223T163953Zlaurent22777@gmail.comdesktop.winevernote.win32Note 2 -

test
test

bl
bla
bla


]]>
20201223T164010Z20201223T164023Zlaurent22777@gmail.comdesktop.winevernote.win32
plain note 2 +

test
test

bl
bla
bla


]]>
20201223T164010Z20201223T164023Zlaurent22777@gmail.comdesktop.winevernote.win32
plain note 2

]]>
20201223T164236Zlaurent22777@gmail.comdesktop.winevernote.win32
diff --git a/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html new file mode 100644 index 000000000..f74f7fb2c --- /dev/null +++ b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html @@ -0,0 +1,11 @@ + + + + + + +
+ + + +
onetwo
threefour
\ No newline at end of file diff --git a/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md new file mode 100644 index 000000000..953d1f3a8 --- /dev/null +++ b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md @@ -0,0 +1,4 @@ +| | | +| --- | --- | +| one | two | +| three | four | \ No newline at end of file diff --git a/packages/lib/import-enex-md-gen.ts b/packages/lib/import-enex-md-gen.ts index a8a459a5d..5440e568e 100644 --- a/packages/lib/import-enex-md-gen.ts +++ b/packages/lib/import-enex-md-gen.ts @@ -1246,6 +1246,14 @@ function drawTable(table: Section) { for (let tdIndex = 0; tdIndex < tr.lines.length; tdIndex++) { const td = tr.lines[tdIndex]; + if (typeof td === 'string') { + // A tag should only have tags as direct children. + // However certain Evernote notes can contain other random tags + // such as empty DIVs. In that case we just skip the content. + // See test "table_with_invalid_content.html". + continue; + } + if (flatRender) { line.push(BLOCK_OPEN);