peter88213 / zim2obsidian

Post-process Zim Markdown export for use with Obsidian.
MIT License
9 stars 1 forks source link

Improve Markdown style linking #17

Open sojusnik opened 1 year ago

sojusnik commented 1 year ago

As continuation of https://github.com/peter88213/zim2obsidian/issues/16:

With the new version of your script and REFORMAT_LINKS = False the custom text in links is now properly depicted and the issue with the removed text with several links in a sentence also disappeared. Many thanks!

After a closer look at the links, still two issues remain with Markdown style linking:

  1. While notes without empty spaces are linked correctly, likeSee this link leading to a [subnote.](./category/note.md), notes with space(s) aren't linked, Obsidian shows that Folder already exists when clicking on them, see: Example of a link to a note at the end of a sentence with ° as custom text.[°](./category/note/same name note.md). In order to be linked properly, the link should have %20 instead of spaces, see: [°](category/note/same%20name%20note.md) (this is how Obsidian links in Markdown style, when doing it through the app).

  2. You'll also recognize that Obsidian doesn't use ./ when linking, instead the path just starts with category/note/…. For the sake of consistency, maybe your wonderful script could also take this into account?

peter88213 commented 1 year ago

Please try v0.11.0 and close this issue if it's working for you.

sojusnik commented 1 year ago

It's a bit better, but links without spaces (but I'm not sure if that's the only reason), still have ./ when converted, e.g.

Zim: See this link leading to a [[category:note|subnote.]] Obsidian: See this link leading to a [subnote.](./category/note.md)

or another one:

Zim: This links to a note with [[category:note:name with (brackets)|brackets in title]] Obsidian: This links to a note with [brackets in title](./category/note/name_with_(brackets).md)

While the first link works properly, the second one isn't, because the note links to name_with_(brackets).md (which is a category in Obsidian), whereas it should link to the note name with (brackets).md. I guess it will be resolved when underscores are removed from categories/folders.

peter88213 commented 1 year ago

Your second example shows a link as is exported with Zim. If it isn't an internal link to a page to be renamed to the custom title, zim2obsidian won't touch it at all.

if you really use link addresses containing parentheses, the best way to handle it may be processing the "raw" Zim notes as discussed in #8. Another solution could be the conversion to wikilinks, see #18.

Maybe there is another way to escape the parentheses? I'll mark this as a "good first issue" for the Pythonistas out there.