connertennery / notion-to-obsidian-converter Goto Github PK
View Code? Open in Web Editor NEWConverts exported Notion notes to work with Obsidian.
License: MIT License
Converts exported Notion notes to work with Obsidian.
License: MIT License
Right now .csv files have their links updated but nothing else is changed. Obsidian doesn't open them so they need to be converted into Markdown tables.
An issue with Notion's exporting is that any data table type is exported as .csv and as folders with each file inside being a record in that table. These need to be turned into Markdown tables with a new page created for them to house the table since there's no corresponding exported page, just a .csv and a folder.
e.g.
Title
not started | in-progress | done |
---|---|---|
task 1 | task 2 | task 3 |
becomes:
Title.csv
Title(folder)
|-task 1
|-task 2
-task 3
Sorry to pester you again :)
I am getting the following error.
PS C:\Users\ DummyMe\Desktop\New folder> node main
Notion Export Path:
A
readline.js:1147
throw err;
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.readdirSync (fs.js:950:10)
at fixNotionExport (C:\Users\ DummyMe\Desktop\New folder\main.js:200:28)
at C:\Users\ DummyMe\Desktop\New folder\main.js:239:17
at Array.forEach (<anonymous>)
at fixNotionExport (C:\Users\ DummyMe\Desktop\New folder\main.js:238:14)
at C:\Users\ DummyMe\Desktop\New folder\main.js:11:17
at Interface._onLine (readline.js:327:5)
at Interface._line (readline.js:658:8)
at Interface._ttyWrite (readline.js:1003:14)
at ReadStream.onkeypress (readline.js:205:10) {
code: 'ERR_INVALID_ARG_TYPE'
}
PS. I ran the old main.js it worked fine (not the table linking, but ran)
Originally posted by @dummifiedme in #11 (comment)
Unix machines use folder/folder2
instead of folder\folder2
, so the links break on Unix. Maybe the path module would be useful here.
I don't know why these are sometimes used, but occasionally there are links that go to specific pages using a Notion URL. e.g. https://www.notion.so/This-is-the-page-title-a7cf21e77e6d411c9d76fa9386e405f6
Seems like they're part of the related records properties.
I'm new to the whole Obsidian world, and something that I have not fully understood is the concept of attachments and attachment folder.
When I use your cli to convert my Notion files to Obsidian, it will create a folder hierarchy in which the .md
file is accompanied with an attachment
folder (with the same name) which contains images OR it might be Level 2 notes and their attachment and so on. Let me give an actual example
Here in my notion I have a Work folder which contains two sub folders
Running this repo cli will result in
At first glance I see that each page has a sibilling attachment
folder (if it contains images etc.), but dragging and dropping them in the Obsidian vault will result in weird hierarchy
which is a mix of attachment and pages.
Do you have any comment on this issue and how do you imagine someone using your cli for converting nested pages (folders) from notion?
Does it makes sense for the cli to accept an option like aggregate attachments into a single folder in the root and all pages' links gets updated accordingly? This way the nested folder in Obsidian would be only for pages (and not attachments).
Hello!
Thank you for creating this script, it will help me with my database relocation from Notion to Obsidian.
Not sure what is happening but I am getting the following message:
Error: Cannot find module 'readline/promises'
Require stack:
- C:\Notion-to-Obsidian-Converter-main\main.js
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m
at Object.<anonymous> (C:\Notion-to-Obsidian-Converter-main\main.js:2:18)
←[90m at Module._compile (node:internal/modules/cjs/loader:1103:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [ ←[32m'C:\\Notion-to-Obsidian-Converter-main\\main.js'←[39m ]
}
Can you please help?
Thanks!
Leo
#21 Shows that users can't see what's actually happening while the script is running.
Add an option to show logging while the script runs so users can verify that it's actually working and see what it's doing.
The database after conversion is shown as a markdown table, but the "link" is gone. Is it something which is difficult to get done or maybe skipped while programmming?
I am very thankful to you for this code btw 👍
Just noticed this and thought I should post.
I used this to exported notion files, with image styled with(I've not edit anything after exporting from notion)
![Untitled](Perceiver%20IO%20A%20General%20Architecture%20for%20Structured%206d4d05e8eeef470f9a3148f92e0250b2/Untitled.png)
but these are converted to ![[Untitled]]
and this seems not working well.
I'm using Windows 11.
Is there anybody treating this issue?
Hi @connertennery! Recently, the Obsidian team has started work on an official plugin called 'Importer', for importing notes from other applications, one of the proposed formats is Notion.
Since you've worked on this script and have extensive knowledge on how the syntax should be properly converted, I was wondering if you're interested in implementing the convertion logic into the plugin. There is a bounty attached to succesfully implementing the code within the provided timeframe (10 days) after assignment.
I've already applied for the assignment, but I'll withdraw it if you're interested in working on it.
Someone has already gotten assigned to the converter, see the issue mentioned above.
This repository doesn't have topics such as notion
, obsidian
, obsidian-md
, markdown-converter
which causes less reach. Please add these topics, so Obsidian users can easily find this great repository! 😊
Functionality was added to fix #10 in the main
branch that doesn't exist in the TS branch. Rewrite it with TS functions.
Pages' links are in languages that are written in non-ascii characters should be decoded in order to appear in the correct way.
For example, a link that is written in Arabic, and should be shown as كتابة 50 تدوينة خلال السنة
is shown as %D9%83%D8%AA%D8%A7%D8%A8%D8%A9%2050%20%D8%AA%D8%AF%D9%88%D9%8A%D9%86%D8%A9%20%D8%AE%D9%84%D8%A7%D9%84%20%D8%A7%D9%84%D8%B3%D9%86%D8%A9
.
This can be fixed easily be using decodeURI
JavaScript's method.
Hello Conner and contributors - thank you so much! I hope you'll forgive me for clogging the system with another issue, it's just the simplest way I found to drop a word of gratitude for you having taken the time to build it and share it with the world. It worked like a charm. Thank yoU!
User @rsdimitrov on the Obsidian forums came across an issue where the paths fail.
It would be conveniont if users could run npx notion-to-obsidian
in their content directory.
$ node main
Notion Export Path:
/Users/bevis/Downloads/Export-3c2c8378-eb74-4a84-b82b-1a8ca3706768
No other logs, Ctrl + C or D doesn't work.
I know this is your work, but I just want to ask an obvious question that probably you have asked for yourself: is there any advantage of this script over visualcurrent/Notion-2-Obsidan? In my try I see that that script makes better result than this one.
The string omd is converted into [[]]. In some languages, this string is used in normal words. For example, in my language the word "omdat" is converted into "[[]]at".
I fixed this by replacing the characters omd into 1o2m3d in my original export, let main.js do its work, and replace 1o2m3d into omd afterwards.
Images are exported in a folder that share's the page's title and are named "Untitled.png" and probably "Untitled-1.png" etc.
Can there be a way to remove the extra lines that notion exports generate? There is one extra new line after each sentence.
Forexample:
Notion Exported Markdown looks like::
Content line one which is like one block.
This is a second line and there shouldn't be any space/newline between these two lines.
And, as I had expressed earlier, THANKS for this tool!
Notion tables have relational properties that allow connections to records of the same table or records of another table. When exported it has the format:
Events: ../Events%202e94ae45e5a748078004f261e2ef5504/A%20Letter%20Delivered%2030c4fe04a118409ea8563041a7a70fb2.md, ../Events%202e94ae45e5a748078004f261e2ef5504/Meeting%20the%20Recruiter%209cfd8aa5a7c849a7a45185df8e9c8569.md, ../Events%202e94ae45e5a748078004f261e2ef5504/Intro%20to%20Gilead%203aced493f7d74fac959b9ead301f449a.md
or
PropertyName: relativePath, relativePath, relativePath
Need to convert all of those relative paths to actual links.
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.