obsidianmd / obsidian-importer

Obsidian Importer lets you import notes from other apps and file formats into your Obsidian vault.
https://help.obsidian.md/import
MIT License
755 stars 72 forks source link

Import from Zim #39

Open sojusnik opened 1 year ago

sojusnik commented 1 year ago

It would be great to have a way to import notes from Zim. Its syntax is described here.

There are currently several ways to convert Zim notes to Obsidian, but all still need some tweaking:

  1. This script is an attempt to directly convert Zim notes to Obsidian.

  2. This script is post-processing Zim notes that were exported to Markdown (through Pandoc, but it has its flaws when exporting through Zim, like missing indented text) with the built-in exporter of Zim. Some issues need attention there, f.i. indentations, checkboxes and code blocks aren't converted properly, as are Markdown and WikiLinks links.

  3. Zim's built-in exporter also allows exporting to HTML, but it's currently unclear how the HTML should look like in order to work with the HTML import feature.

Please upvote this issue, if you would like to import your notes from Zim.

reagle commented 1 year ago

For what it's worth (little) here's the script I used to take zim-exported markdown and make it more suitable for use in Obsidian by removing the (redundant) title heading and converting setext to atx headers. I hadn't found the first and second scripts myself; they are probably better.

I still had to manually tweak things once I was in Obsidian, but the script got me started. Plus, zim's markdown export is not great, so I found some manual tweaks were going to necessary in any case.

sojusnik commented 1 year ago

For what it's worth (little) here's the script I used to take zim-exported markdown and make it more suitable for use in Obsidian by removing the (redundant) title heading and converting setext to atx headers. I hadn't found the first and second scripts myself; they are probably better.

This is exactly what the second script from above is doing and a little more.

I still had to manually tweak things once I was in Obsidian, but the script got me started. Plus, zim's markdown export is not great, so I found some manual tweaks were going to necessary in any case.

How did you solve the issue with indentations after converting?

reagle commented 1 year ago

I did a lot of regex across my vault in Sublime Text.

ricir commented 1 year ago

Very good suggestions. My choice (I still need some testing) could be export from Zim and apply option 2. What is missing, however, (if I am not wrong) is the possibility to add YAML front-matter in the Obsidian file, keeping the creation timestamp, which is present in Zim notes and lost in the conversion.

sojusnik commented 1 year ago

@ricir

My choice (I still need some testing) could be export from Zim and apply option 2.

While the second option has its elegance, the first one seems to be the better one regarding the potential end result, because the second option has some in-built limitations, like the proper conversion of indented text or new lines before and after lines starting with checkboxes.

What is missing, however, (if I am not wrong) is the possibility to add YAML front-matter in the Obsidian file, keeping the creation timestamp, which is present in Zim notes and lost in the conversion.

This would be of course helpful as well, but it would already help a lot to have a reliable conversion of only the content, without the metadata.

Roughly three weeks ago the developer of the first script expressed his interest in improving it, but since then no actions were taken.

hsandt commented 7 months ago

I also found markdown2zim (https://github.com/Xunius/markdown2zim) which despite the name also converts zim to markdown, but I see no specific "Obsidian dialect" support so I don't think it'll work well on internal links and we'll have to see for attached pictures (but should be good for the simple notes).

I have yet to try any of those tools, but I will start a huge conversion of my Zim notes to Obsidian soon, starting with a sample page containing all kinds of elements.

I will post the results and compare them to pick the best option - or wait if none is good enough and open corresponding issues on each repository (but all notes without pictures/internal links should probably be fine).

sojusnik commented 2 months ago

I will post the results and compare them to pick the best option - or wait if none is good enough and open corresponding issues on each repository (but all notes without pictures/internal links should probably be fine).

@hsandt did you have any success?

kepano commented 2 months ago

A reminder that this repo accepts PRs, see contribution guidelines.