quartz icon indicating copy to clipboard operation
quartz copied to clipboard

Better support for relative/absolute paths

Open jackyzha0 opened this issue 3 years ago • 4 comments

Quite a few beginner mistakes with Quartz come with is assuming that Quartz support relative paths out of the box. Currently, Quartz is quite naive in trying to transform relative into absolute but it would be better to just make this an explicit config option like useRelative: true in config.toml

Some features like backlinks and graph assume absolute path by default so some behaviour is unexpected when users use relative paths (e.g. duplicate graph notes)

Related issues: https://github.com/jackyzha0/quartz/issues/98, https://github.com/jackyzha0/quartz/issues/90, #99

jackyzha0 avatar Apr 05 '22 17:04 jackyzha0

Hey! I sort of just assumed that relative path was how it works from the editing.md page, is that not true?

Also, on Twitter, you said that you support aliases through the YAML frontmatter. Is YAML frontmatter required, or can we put anything we want into the display part of the markdown link? For example, in the screenshot below, does the config page have an alias in the YAML that says aliases: A link to the config page?

CleanShot 2022-04-20 at 09 38 05

classicrob avatar Apr 20 '22 16:04 classicrob

So the naive method that Quartz tries is to prefix everything with / to see if the absolute path exists in the folder, otherwise it tries to resolve the path relative to the path of the current file you are in (this is a pretty whacky assumption which is why this issue exists). Generally, I recommend users toggle on the "Absolute path in vault" option in Obsidian to have it play nicely. YAML frontmatter is required for all notes but you don't need to define an alias for each link. All MD links are just display links (i.e. you can have Any text here). Aliases are more so you can link to note with actual path/a but link to it as another name [Some link text](/b)

jackyzha0 avatar Apr 20 '22 16:04 jackyzha0

So, do you consider an alias here to be a regular markdown link, where the anchor text is different from the URL, or could one wikilink to an alias?

So that [[Some link text]] would go to /b

benbohmer avatar Apr 22 '22 12:04 benbohmer

So, do you consider an alias here to be a regular markdown link, where the anchor text is different from the URL, or could one wikilink to an alias?

So that [[Some link text]] would go to /b

The latter, you can wikilink to an alias!

jackyzha0 avatar Apr 22 '22 15:04 jackyzha0

New to this place, not much programming knowledge so sorry if there is a way and I don't know how to. I need to publish images to the web and the path ![[image.png]] does not work, I need to manually change it to ! [image] (image.png) Since I batch export annotations form Zotero, changing manually every time is a hassle. Is there a way to let it render images in the wiki format?

lorenasilvaaraujo avatar Dec 20 '22 10:12 lorenasilvaaraujo

I think https://github.com/jackyzha0/quartz/issues/271 could be caused from this.

ryanwwest avatar Jan 15 '23 22:01 ryanwwest

I have a deeply nested structure and would like to use either Wiki Links or relative MarkDown Links, but neither seem to work:

  • with relative Links, the Page-Links work fine and the Graph renders, but clicking any Link on a Graph-Node leads to errors: chemical Elements
  • I also tried to set the base-url to a relative path or to switch to useRelative: true in config.toml , but then the graph would not render.

I have seen the issue #16 as closed and wonder if WikiLinks work (or do they only if you have a flat Vault without Subfolders?)

If you want to reproduce the problem: the Repo is a public fork of yours: SpocWiki Repo

SpocWeb avatar Feb 21 '23 05:02 SpocWeb

This issue should be fixed in Quartz 4. I'll be closing it for now but please reopen this issue if this persists in the new version.

jackyzha0 avatar Aug 20 '23 02:08 jackyzha0