def post_process_content(self): self._post_processed_content = self._converted_content self._post_processed_content = helper_functions.replace_markdown_pseudo_html_href_tag_with_markdown_links( self._post_processed_content) self.post_process_obsidian_image_links_if_required() self.add_meta_data_if_required() self._current_note_attachment_links = get_attachment_paths( self._conversion_settings.source_absolute_root, self._conversion_settings.export_format, self._file, self._files_to_convert, self._post_processed_content) self._post_processed_content = update_content_with_new_paths( self._post_processed_content, self._file, self._current_note_attachment_links.non_copyable_relative, self._conversion_settings.make_absolute, self._conversion_settings.export_folder_absolute)
def post_process_content(self): self.logger.debug(f'Post process HTML content') self._post_processed_content = self._converted_content self._post_processed_content = update_href_link_suffix_in_content( self._post_processed_content, self._output_extension, self._files_to_convert) self.add_meta_data_if_required() self.update_checklists() self._current_note_attachment_links = get_attachment_paths( self._conversion_settings.source_absolute_root, self._conversion_settings.export_format, self._file, self._files_to_convert, self._post_processed_content) self._post_processed_content = update_content_with_new_paths( self._post_processed_content, self._file, self._current_note_attachment_links.non_copyable_relative, self._conversion_settings.make_absolute, self._conversion_settings.export_folder_absolute)
def post_process_content(self): self._post_processed_content = self._converted_content self._post_processed_content = helper_functions.replace_markdown_pseudo_html_href_tag_with_markdown_links( self._post_processed_content) self.post_process_obsidian_image_links_if_required() self.update_checklists() self.add_meta_data_if_required() if self._iframes_dict: self.logger.debug(f'Add iframes to Markdown content') self._post_processed_content = post_process_iframes_to_markdown( self._post_processed_content, self._iframes_dict) self.add_one_last_line_break() self._current_note_attachment_links = get_attachment_paths( self._conversion_settings.source_absolute_root, self._conversion_settings.export_format, self._file, self._files_to_convert, self._post_processed_content) self._post_processed_content = update_content_with_new_paths( self._post_processed_content, self._file, self._current_note_attachment_links.non_copyable_relative, self._conversion_settings.make_absolute, self._conversion_settings.export_folder_absolute)
def test_update_content_with_new_paths_for_non_movable_attachments(tmp_path): Path(tmp_path, 'some_folder/data/my_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_other_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_notebook/note.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/one.png').touch() Path(tmp_path, 'some_folder/data/attachments/two.csv').touch() Path(tmp_path, 'some_folder/three.png').touch() Path(tmp_path, 'some_folder/attachments/four.csv').touch() Path(tmp_path, 'some_folder/four.csv').touch() Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/six.csv').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eight.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/nine.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png').touch() file_path = Path(tmp_path, 'some_folder/data/my_notebook/note.md') content = f'![copyable|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ f'![non-existing|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/two.png)\n' \ f'![non-copyable|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/three.png)\n' \ f'![non-copyable|600](../../three.png)\n' \ f'![non-existing|600](attachments/three.pdf)\n' \ f'![copyable|600](attachments/eight.pdf)\n' \ f'![copyable](../attachments/two.csv)\n' \ f'![non-copyable](../../attachments/four.csv)\n' \ f'![non-existing](../my_notebook/seven.csv)\n' \ f'![copyable](../my_notebook/six.csv)\n' \ f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ f'![note link](nine.md)\n' \ f'[a web link](https://www.google.com)\n' \ f'<img src="attachments/ten.png" />\n' \ f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ f'![copyable](attachments/file%20twelve.pdf)\n' \ f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ f'<img src="attachments/file%20fourteen.png" />\n' \ f'<a href="https://www.google.com">google</a>)\n' \ f'![]()\n' \ f'<img src="" />\n' \ f'<a href="">empty href link</a>' expected_content = f'![copyable|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ f'![non-existing|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/two.png)\n' \ f'![non-copyable|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/three.png)\n' \ f'![non-copyable|600]({helper_functions.path_to_posix_str(tmp_path)}/some_folder/three.png)\n' \ f'![non-existing|600](attachments/three.pdf)\n' \ f'![copyable|600](attachments/eight.pdf)\n' \ f'![copyable](../attachments/two.csv)\n' \ f'![non-copyable]({str(tmp_path.as_posix())}/some_folder/attachments/four.csv)\n' \ f'![non-existing](../my_notebook/seven.csv)\n' \ f'![copyable](../my_notebook/six.csv)\n' \ f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ f'![note link](nine.md)\n' \ f'[a web link](https://www.google.com)\n' \ f'<img src="attachments/ten.png"/>\n' \ f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ f'![copyable](attachments/file%20twelve.pdf)\n' \ f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ f'<img src="attachments/file%20fourteen.png"/>\n' \ f'<a href="https://www.google.com">google</a>)\n' \ f'![]()\n' \ f'<img src=""/>\n' \ f'<a href="">empty href link</a>' conversion_settings = ConversionSettings() conversion_settings.source = Path(tmp_path, 'some_folder/data') conversion_settings.export_folder = Path(tmp_path, 'some_folder/export') conversion_settings.export_format = 'obsidian' conversion_settings.conversion_input = 'markdown' conversion_settings.make_absolute = True file_converter = HTMLToMDConverter(conversion_settings, 'files_to_convert') file_converter._file = file_path file_converter._files_to_convert = { Path(tmp_path, 'some_folder/data/my_notebook/nine.md') } attachment_links = get_attachment_paths( file_converter._conversion_settings.source_absolute_root, file_converter._conversion_settings.export_format, file_converter._file, file_converter._files_to_convert, content) result_content = update_content_with_new_paths( content, file_converter._file, attachment_links.non_copyable_relative, file_converter._conversion_settings.make_absolute, file_converter._conversion_settings.export_folder_absolute, ) assert result_content == expected_content
def test_generate_set_of_attachment_paths_html_export_format(tmp_path): Path(tmp_path, 'some_folder/data/my_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_other_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/nine.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png').touch() file_path = Path(tmp_path, 'some_folder/data/my_notebook/note.md') content = f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ f'![note link](nine.md)\n' \ f'[a web link](https://www.google.com "google")\n' \ f'<img src="attachments/ten.png" />\n' \ f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ f'![copyable](attachments/file%20twelve.pdf)\n' \ f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ f'<img src="attachments/file%20fourteen.png" />' # expected_content = f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ # f'![note link](nine.md)\n' \ # f'[a web link](https:\\www.google.com "google")\n' \ # f'<img src="attachments/ten.png" />\n' \ # f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ # f'![copyable](attachments/file%20twelve.pdf)\n' \ # f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ # f'<img src="attachments/file%20fourteen.png" />' conversion_settings = ConversionSettings() conversion_settings.source = Path(tmp_path, 'some_folder/data') conversion_settings.export_folder = Path(tmp_path, 'some_folder/export') conversion_settings.export_format = 'html' file_converter = MDToHTMLConverter(conversion_settings, 'files_to_convert') file_converter._file = file_path file_converter._files_to_convert = { Path(tmp_path, 'some_folder/data/my_notebook/nine.md') } attachment_links = get_attachment_paths( file_converter._conversion_settings.source_absolute_root, file_converter._conversion_settings.conversion_input, file_converter._file, file_converter._files_to_convert, content) assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf') \ in attachment_links.copyable_absolute assert len(attachment_links.copyable_absolute) == 5 assert f'attachments/file thirteen.pdf' in attachment_links.non_existing assert len(attachment_links.non_existing) == 1
def test_get_attachment_paths_where_make_absolute_for_non_copyable_files(tmp_path): Path(tmp_path, 'some_folder/data/my_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_other_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_notebook/note.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/one.png').touch() Path(tmp_path, 'some_folder/data/attachments/two.csv').touch() Path(tmp_path, 'some_folder/three.png').touch() Path(tmp_path, 'some_folder/attachments/four.csv').touch() Path(tmp_path, 'some_folder/four.csv').touch() Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/six.csv').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eight.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/nine.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png').touch() file_path = Path(tmp_path, 'some_folder/data/my_notebook/note.md') content = f'![copyable|600]({str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ f'![non-existing|600]({str(tmp_path)}/some_folder/two.png)\n' \ f'![non-copyable|600]({str(tmp_path)}/some_folder/three.png)\n' \ f'![non-copyable|600](../../three.png)\n' \ f'![non-existing|600](attachments/three.pdf)\n' \ f'![copyable|600](attachments/eight.pdf)\n' \ f'![copyable](../attachments/two.csv)\n' \ f'![non-copyable](../../attachments/four.csv)\n' \ f'![non-existing](../my_notebook/seven.csv)\n' \ f'![copyable](../my_notebook/six.csv)\n' \ f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ f'![note link](nine.md)\n' \ f'[a web link](https://www.google.com "google")\n' \ f'<img src="attachments/ten.png" />\n' \ f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ f'![copyable](attachments/file%20twelve.pdf)\n' \ f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ f'<img src="attachments/file%20fourteen.png" />\n' \ f'<a href="https://www.google.com "google">)' # expected_content = f'![copyable|600]({str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ # f'![non-existing|600]({str(tmp_path)}/some_folder/two.png)\n' \ # f'![non-copyable|600]({str(tmp_path)}/some_folder/three.png)\n' \ # f'![non-copyable|600]({str(tmp_path)}/some_folder/three.png)\n' \ # f'![non-existing|600](attachments/three.pdf)\n' \ # f'![copyable|600](attachments/eight.pdf)\n' \ # f'![copyable](../attachments/two.csv)\n' \ # f'![non-copyable]({str(tmp_path)}/some_folder/attachments/four.csv)\n' \ # f'![non-existing](../my_notebook/seven.csv)\n' \ # f'![copyable](../my_notebook/six.csv)\n' \ # f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ # f'![note link](nine.md)\n' \ # f'[a web link](https://www.google.com "google")\n' \ # f'<img src="attachments/ten.png" />\n' \ # f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ # f'![copyable](attachments/file%20twelve.pdf)\n' \ # f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ # f'<img src="attachments/file%20fourteen.png" />\n' \ # f'<a href="https://www.google.com "google">)' conversion_settings = ConversionSettings() conversion_settings.source = Path(tmp_path, 'some_folder/data') conversion_settings.export_folder = Path(tmp_path, 'some_folder/export') conversion_settings.export_format = 'obsidian' # conversion_settings.conversion_input = 'markdown' file_converter = HTMLToMDConverter(conversion_settings, 'files_to_convert') file_converter._file = file_path file_converter._files_to_convert = {Path(tmp_path, 'some_folder/data/my_notebook/nine.md')} attachment_links = get_attachment_paths(file_converter._conversion_settings.source_absolute_root, file_converter._conversion_settings.conversion_input, file_converter._file, file_converter._files_to_convert, content) assert len(attachment_links.all) == 16 assert len(attachment_links.copyable) == 9 assert len(attachment_links.copyable_absolute) == 9 assert len(attachment_links.existing) == 12 assert len(attachment_links.non_copyable_absolute) == 1 assert len(attachment_links.non_copyable_relative) == 2 assert len(attachment_links.non_existing) == 4 assert Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/one.png') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/six.csv') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/attachments/two.csv') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/eight.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf') \ in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png') \ in attachment_links.copyable_absolute assert len(attachment_links.copyable_absolute) == 9 assert f'{tmp_path}/some_folder/two.png' in attachment_links.non_existing assert f'attachments/three.pdf' in attachment_links.non_existing assert f'../my_notebook/seven.csv' in attachment_links.non_existing assert f'attachments/file thirteen.pdf' in attachment_links.non_existing assert len(attachment_links.non_existing) == 4 assert '../../attachments/four.csv' in attachment_links.non_copyable_relative assert '../../three.png' in attachment_links.non_copyable_relative assert len(attachment_links.non_copyable_relative) == 2 # three.png is used twice, once with relative path and once with absolute path as we are # searching post processed content the content will already have had make absolute applied if it was turned on # so we still get one path to three in the relative list assert f'{tmp_path}/some_folder/three.png' in attachment_links.non_copyable_absolute assert len(attachment_links.non_copyable_absolute) == 1
def test_get_attachment_paths_markdown_export_format(tmp_path): Path(tmp_path, 'some_folder/data/my_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_other_notebook/attachments').mkdir(parents=True) Path(tmp_path, 'some_folder/data/my_notebook/note.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/one.png').touch() Path(tmp_path, 'some_folder/data/attachments/two.csv').touch() Path(tmp_path, 'some_folder/three.png').touch() Path(tmp_path, 'some_folder/attachments/four.csv').touch() Path(tmp_path, 'some_folder/four.csv').touch() Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/six.csv').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eight.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/nine.md').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf').touch() Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png').touch() file_path = Path(tmp_path, 'some_folder/data/my_notebook/note.md') content = f'![copyable|600]({str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ f'![non-existing|600]({str(tmp_path)}/some_folder/two.png)\n' \ f'![non-copyable|600]({str(tmp_path)}/some_folder/three.png)\n' \ f'![non-existing|600](attachments/three.pdf)\n' \ f'![copyable|600](attachments/eight.pdf)\n' \ f'![copyable](../attachments/two.csv)\n' \ f'![non-copyable](../../attachments/four.csv)\n' \ f'![non-existing](../my_notebook/seven.csv)\n' \ f'![copyable](../my_notebook/six.csv)\n' \ f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ f'![note link](nine.md)\n' \ f'[a web link](https://www.google.com "google")\n' \ f'<img src="attachments/ten.png" />\n' \ f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ f'![copyable](attachments/file%20twelve.pdf)\n' \ f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ f'<img src="attachments/file%20fourteen.png" />' # expected_content = f'![copyable|600]({str(tmp_path)}/some_folder/data/my_notebook/attachments/one.png)\n' \ # f'![non-existing|600]({str(tmp_path)}/some_folder/two.png)\n' \ # f'![non-copyable|600]({str(tmp_path)}/some_folder/three.png)\n' \ # f'![non-existing|600](attachments/three.pdf)\n' \ # f'![copyable|600](attachments/eight.pdf)\n' \ # f'![copyable](../attachments/two.csv)\n' \ # f'![non-copyable](../attachments/four.csv)\n' \ # f'![non-existing](../my_notebook/seven.csv)\n' \ # f'![copyable](../my_notebook/six.csv)\n' \ # f'![copyable](../my_other_notebook/attachments/five.pdf "test tool tip text")\n' \ # f'![note link](nine.md)\n' \ # f'[a web link](https://www.google.com "google")\n' \ # f'<img src="attachments/ten.png" />\n' \ # f'<a href="attachments/eleven.pdf">example-attachment.pdf</a>\n' \ # f'![copyable](attachments/file%20twelve.pdf)\n' \ # f'<a href="attachments/file%20thirteen.pdf">example-attachment.pdf</a>\n' \ # f'<img src="attachments/file%20fourteen.png" />' conversion_settings = ConversionSettings() conversion_settings.source = Path(tmp_path, 'some_folder/data') conversion_settings.export_folder = Path(tmp_path, 'some_folder/export') conversion_settings.export_format = 'obsidian' conversion_settings.make_absolute = False # conversion_settings.conversion_input = 'markdown' file_converter = HTMLToMDConverter(conversion_settings, 'files_to_convert') file_converter._file = file_path file_converter._files_to_convert = {Path(tmp_path, 'some_folder/data/my_notebook/nine.md')} attachment_links = get_attachment_paths(file_converter._conversion_settings.source_absolute_root, file_converter._conversion_settings.conversion_input, file_converter._file, file_converter._files_to_convert, content) assert len(attachment_links.all) == 15 assert len(attachment_links.copyable) == 9 assert len(attachment_links.copyable_absolute) == 9 assert len(attachment_links.existing) == 11 assert len(attachment_links.non_copyable_relative) == 1 assert len(attachment_links.non_copyable_absolute) == 1 assert len(attachment_links.non_existing) == 4 assert Path(tmp_path, 'some_folder/data/my_other_notebook/attachments/five.pdf') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/one.png') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/six.csv') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/attachments/two.csv') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/eight.pdf') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/ten.png') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/eleven.pdf') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file twelve.pdf') in attachment_links.copyable_absolute assert Path(tmp_path, 'some_folder/data/my_notebook/attachments/file fourteen.png') in attachment_links.copyable_absolute assert len(attachment_links.copyable_absolute) == 9 assert f'{tmp_path}/some_folder/two.png' in attachment_links.non_existing assert f'attachments/three.pdf' in attachment_links.non_existing assert f'../my_notebook/seven.csv' in attachment_links.non_existing assert f'attachments/file thirteen.pdf' in attachment_links.non_existing assert len(attachment_links.non_existing) == 4 # NOTE for the "some_folder/attachments/four.csv" attachment the content should be updated to a new relative link # assert Path(tmp_path, 'some_folder/attachments/four.csv') in file_converter._non_copyable_attachment_path_set assert '../../attachments/four.csv' in attachment_links.non_copyable_relative assert len(attachment_links.non_copyable_relative) == 1 assert f'{tmp_path}/some_folder/three.png' in attachment_links.non_copyable_absolute assert len(attachment_links.non_copyable_absolute) == 1