diff --git a/enex2notion/note_parser/note.py b/enex2notion/note_parser/note.py index a0003fe..09554e9 100644 --- a/enex2notion/note_parser/note.py +++ b/enex2notion/note_parser/note.py @@ -44,6 +44,15 @@ def _parse_note_dom(note: EvernoteNote) -> Optional[Tag]: logger.error(f"Failed to extract DOM from note '{note.title}'") return None + return _filter_yinxiang_markdown(note_dom) + + +def _filter_yinxiang_markdown(note_dom: Tag) -> Tag: + last_block = note_dom.contents[-1] + + if last_block and "display:none" in last_block.attrs.get("style", ""): + last_block.extract() + return note_dom diff --git a/tests/test_note_parser.py b/tests/test_note_parser.py index 820dbfb..25841cf 100644 --- a/tests/test_note_parser.py +++ b/tests/test_note_parser.py @@ -654,6 +654,29 @@ def test_linebreaks_inside_root(parse_html): ] +def test_yinxiang_markdown(parse_rules): + test_note = EvernoteNote( + title="test1", + created=datetime(2021, 11, 18, 0, 0, 0, tzinfo=tzutc()), + updated=datetime(2021, 11, 18, 0, 0, 0, tzinfo=tzutc()), + content=( + "" + "
test1
" + "
test2
" + "
" + ), + tags=[], + author="", + url="", + is_webclip=False, + resources=[], + ) + + assert parse_note(test_note, parse_rules) == [ + NotionTextBlock(text_prop=TextProp("test1")), + ] + + def test_resource_recursive(smallest_gif, parse_rules): test_note = EvernoteNote( title="test1",