Maboroshy / Note-Station-to-markdown

The cross-platform script that converts notes from Synology Note Station to markdown files
Apache License 2.0
240 stars 51 forks source link

Convert Notes with tables and pictures #34

Closed MrLagavulin closed 7 months ago

MrLagavulin commented 8 months ago

Converting plain text notes works quite well on Windows 11, but I'm currently having two problems:

  1. Notes with tables
  2. Notes with images/screenshots

1 Message:

Unconverted table found. Tweaking pandoc options may (or may not) allow to convert it.

How to tweek pandoc? This error does not stop the conversion.

2 Message:

Traceback (most recent call last): File "C:\Users\Lagavulin\Documents\Einstellungen\NAS\Notes\nsx2md.py", line 236, in link_path = urllib.request.pathname2url(link_path).replace('///', '') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Lib\nturl2path.py", line 73, in pathname2url raise OSError(error) OSError: Bad path: media/2456https://static.tp-link.com/image023_1493261584939q.png

This error is particularly annoying because it aborts the conversion. It would be helpful if, when an error occurs, the conversion would skip the erroneous note and continue with the next one. Then, if necessary, I would copy the incorrect notes by hand.

Thanks again for having a look in this.

Maboroshy commented 8 months ago
  1. Pandoc conversion options can be tweaked in line 44 of the script. I've made the warning message a bit more informative.
  2. Could you send me .nsx file with the note. The url thing just should not be in the image path.
MrLagavulin commented 7 months ago

As requested, here is the export of a test notebook with the problematic note (renamed as zip). 20240409_202124_7594_Lagavulin.zip

Since it was the only one causing these problems, I transferred it manually. The images are probably loaded from the www when they are accessed, so they are not really integrated into the note. I've also transferred the tables manually in the meantime; there weren't too many of them.

Thanks anyway for the support

Maboroshy commented 7 months ago

The issue is fixed. You note is converted correctly with by the new version, with all the images.

MrLagavulin commented 7 months ago

When I try with the new Version, I get: PS C:\Users\Lagavulin\Documents\Einstellungen\NAS\Notes\Test> python nsx2md.py File "C:\Users\Lagavulin\Documents\Einstellungen\NAS\Notes\Test\nsx2md.py", line 106

Note-Station-to-markdown/nsx2md.py at master · Maboroshy/Note-Station-to-markdown
                                                    ^

SyntaxError: invalid character '·' (U+00B7)

Maboroshy commented 7 months ago

Could you recheck. Line 106 of the script is if attachment_list:, it can't raise SyntaxError. Where does Note-Station-to-markdown/nsx2md.py at master · Maboroshy/Note-Station-to-markdown comes from? It's that · symbol that causes the issue. When I download the code from GitHub I get Note-Station-to-markdown-master.zip. How have you got this path?

Maboroshy commented 7 months ago

Could you send me .nsx file with the note.

Maboroshy commented 7 months ago

I've manually inserted Note-Station-to-markdown/nsx2md.py at master · Maboroshy/Note-Station-to-markdown as notebook and note title in the test note you've sent before and it was all good in Windows.

Maboroshy commented 7 months ago

I've also just tweaked path handling a little more. Maybe it will change something for the new issue.

MrLagavulin commented 7 months ago

In the latest version it's line 108:

Note-Station-to-markdown/nsx2md.py at master · Maboroshy/Note-Station-to-markdown

This dot (U+00B7) is the Problem. 20240409_202124_7594_Lagavulin.zip

Maboroshy commented 7 months ago

It looks like you've downloaded the script by saving it's GitHub web page instead of the script file itself. Could you download the script by <> Code button at the top -> Download ZIP.

MrLagavulin commented 7 months ago

Oh, sorry, I always downloaded the script directly, never via the ZIP download. I'm still a little untrained in these things. In fact, it now works without any error message. Thank you very much.