maboroshy / note-station-to-markdown Goto Github PK
View Code? Open in Web Editor NEWThe cross-platform script that converts notes from Synology Note Station to markdown files
License: Apache License 2.0
The cross-platform script that converts notes from Synology Note Station to markdown files
License: Apache License 2.0
my first time using github or python, so go easy on me plz! I'm getting this error everytime
File "nsx2md.py", line 130, in
for attachment_id in note_data.get('attachment', ''):
Hi Maboroshy,
when run this script in Windows 10 and Python 3.7.3, I get following error output:
Found pandoc exe 2.7.3
Traceback (most recent call last):
File "nsx2md.py", line 66, in
if distutils.version.LooseVersion(pandoc_ver) < distutils.version.LooseVersion('1.16'):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1008.0_x64__qbz5n2kfra8p0\lib\distutils\version.py", line 52, in lt
c = self._cmp(other)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1008.0_x64__qbz5n2kfra8p0\lib\distutils\version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
Can I do something to fix it or is it a problem of the code?
The image file is available in the media folder, yet it doesn't appear correctly in Obsidian. Could you investigate this problem? Thank you.
![](file://media/59661686846628447.png)
Needed just this today and really appreciate that you made it and released it.
Feel free to close this issue, just wanted to say thanks.
Unless you use the 'multiline_tables' extension to pandoc, any table containing a block element such as a DIV will be completely replaced by the string "[TABLE]", potentially causing significant data loss. Note Station apparently inserts all kinds of cruft into its tables.
Hi,
first of all, thank you for your great job.
I have this issue with Pictures.
I exported all my DS Notes and then imported in Obsidian.
I can't see the pictures, when the format is like this after the export:
But if I try to link it like this ![[15101598275384230.png]], it works.
Do you habe any suggestion?
Thank you very much!
Michael
for example,
ex. foo_hello_world.md , it's content will be:
foo_hello_world
======
Wonderful script, you saved my life.
Just found some media filename were not correctly "translated". It was the case with special char in the filename with % char
ex: filename in the media folder: 5-petit-de%CC%81jeuner.png
and the link was media 5-petit-de%25CC%2581jeuner.png
as you can see the script systematically skips the 2 digits following the % char
not a big deal, but opportunity for improvement
any suggestions?
Traceback (most recent call last):
File "nsx2md.py", line 33, in <module>
config_data = json.loads(nsx.read('config.json'))
File "/usr/lib64/python3.4/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
Notestation 2.4.3-0810
Python 2.7.5
pandoc 1.12.3.1
RHEL 7.3
I have one note with a title length of 414 characters, this causes a crash on line 223 md_file_path.write_text(content, 'utf-8').
Shortening the title in the sanitise_path_string(path_str) method resolves the issue.:
if truncate_title and len(path_str) > truncate_title_chars:
path_str = path_str[:truncate_title_chars]
But this requires adding new settings as for example:
truncate_title = True # Catch problems with titles that are too long
truncate_title_chars = 200 # Do not allow more than X characters for a title
I get the error "ModuleNotFoundError: No module named 'distutils'" when running but it seems distulis is legacy?
https://docs.python.org/3.10/library/distutils.html
Am I doing it wrong?
Thanks in advance.
The script delivers an error if two notes have attachments, which have identical filenames.
The error message reads as follows:
Traceback (most recent call last): File "nsx2md.py", line 119, in <module> '{}/{}/{}'.format(notebook_title, media_dir, name)) FileExistsError: [WinError 183] Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist:
Would it be possible to change the code in a way that it attaches increasing numbers to filenames if they already exist?
A few of my notes were triggering this error, which appears to be a 5s wait for pandoc to do its thing:
Traceback (most recent call last):
File "./nsx2md.py", line 133, in <module>
pandoc.wait(5)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 990, in wait
return self._wait(timeout=timeout)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1616, in _wait
raise TimeoutExpired(self.args, timeout)
subprocess.TimeoutExpired: Command '['pandoc', '-f', 'html', '-t', 'markdown_strict+pipe_tables-raw_html', '--wrap=none', '--atx-headers', '-o', '/var/folders/gg/8fhvnc85693bnnpcw53k1jt80000gn/T/tmpqskz8j8t', '/var/folders/gg/8fhvnc85693bnnpcw53k1jt80000gn/T/tmpvw_o1sn3']' timed out after 5 seconds
I solved it by changing the wait to 20s:
pandoc = subprocess.Popen(pandoc_args)
pandoc.wait(20)
Maybe the delay could be extended by default, or just break it out as a setting like the other options at the top of the file?
Thanks a million the script works great! I'm using it to migrate from DS Note to Joplin currently
When using the "@tag tagging in note text (experimental)" script in QOwnNote it is useful to import the tags directly with an @, so you could add the following:
use_at_tags = False # True when you want to use experimental @tags of QOwnNotes
Modification for the tag writing:
if note_data.get('tag', '') and use_at_tags:
content = 'Tags: @{} \n{}'.format(', @'.join(note_data['tag']), content)
else:
content = 'Tags: {} \n{}'.format(', '.join(note_data['tag']), content)
When the trash is not empty, it gives me this error on line 132:
parent_notebook = notebook_id_to_path_index[parent_notebook_id]
KeyError: '1027_#00000000'
Emptying the trash and re-exporting the notebook solves the issue.
Hi,
I got this OSError: [Errno 63] File name too long
on MacOS for a file named /media/b9e5d7dfb4f4315b201e813e77057476_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_46_47_48_49_50_51_52_53_54_55_56_57_58_59_60_61_62_63_64_65_66_67_68_69_70_71_72_73_74_75_76.jpeg
Anything possible to at least skip this then? Or better rename it somehow?
I'm sure this is a blatant noobie error, but ... I get...
F:\nsx2md>python nsx2md.py
File "nsx2md.py", line 7
^
SyntaxError: invalid syntax
I'm running Win10x64 with Python37 (x64) and lastest Pandoc (x64). Both Python and Pandoc are in PATH. I tried moving the py script and the nsx file into the Python folder, but same message.
Is there any chance to add functionality to convert NSX to HTML for subsequent importing into other applications (e.g., OneNote)?
Converting plain text notes works quite well on Windows 11, but I'm currently having two problems:
How to tweek pandoc?
This error does not stop the conversion.
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.
Hi, great script! Question, are tables expected to be converted to [TABLE] with discarded content? If not, are you planning to implement table conversion, or at least embed its content between code tags perhaps?
The converted files only contain the title of the note, not the content.
NSX attached renamed as ZIP.
20240331_144226_11102_Lagavulin.zip
Thanks for having a look at this.
After the script completes I get the message:
Converted 16 notebooks and 371 out of 384 notes. Press Enter to quit...
Is it possible to get more info about what was not converted? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.