Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to render relative wikilinks #8

Open
jkanche opened this issue May 21, 2022 · 6 comments
Open

fails to render relative wikilinks #8

jkanche opened this issue May 21, 2022 · 6 comments

Comments

@jkanche
Copy link

jkanche commented May 21, 2022

I have a directory structure that looks something like this

  • dir1
    • sub_dir1
      • notes.md
    • intro.md
  • dir2
    ... and so on

intro.md has a wiki link to notes.md. Foam creates a relative backlink on the markdown page

[//begin]: # "Autogenerated link references for markdown compatibility"
[notes]: <sub_dir1/notes.md> "Notes"
[//end]: # "Autogenerated link references"

This works fine in vscode but the generated pages fails to understand the relative backlinks.

@hikerpig
Copy link
Owner

hikerpig commented May 22, 2022

I see, the link references are generated by Foam.
But I don't know why there are <> around the reference, did you add it by hand ?
What is your Foam's version?

[notes]: <sub_dir1/notes.md> "Notes"

I use Obsidian instead of Foam now, and gatsby-theme-kb can handle file lookup without the help of Foam-generated footers. In some of my old files, the references are stile there and they can be rendered, they are not wrapped in <>.

[static-site-generator]: ../misc/static-site-generator.md "Static Site Generator"

@jkanche
Copy link
Author

jkanche commented May 22, 2022

I use the latest version of foam and it seems like it automatically adds the <...> around the links.

It seems to effect link previews on the theme when I use the default markdown link style rather than wikilinks.

awesome work on the theme 👌

@hikerpig
Copy link
Owner

Thank you for paying attention to this theme 😃

I install the latest 0.18.3 Foam, but there aren't <>. Maybe there are some settings about this - which I don't see either.

And I checked the foam repo's docs, still not a clue, their links aren't wrapped. for example:

image

And yes, if you only use a plain markdown link as below, the hover preview and backlinks will not work, for gatsby-theme-kb will only extract wikilinks inside [[]]

A paragraph with a [markdown link](../some-other-file.md)

@jkanche
Copy link
Author

jkanche commented May 23, 2022

awesome, I switched to obsidian and it works great. I was wondering if there a way for the theme to show backlinks/references if available ?

there are a few interesting plugins like metadata extractor that would be able to provide this information

@hikerpig
Copy link
Owner

The theme does show backlinks - only if they are wikilinks, see https://foam-template-gatsby-kb-hikerpig.vercel.app/wiki-links.

I think you are requesting a feature - the theme should extract plain markdowndown internal links. This is reasonable, I've added an issue.

Will try to do it in the weekend.

@hikerpig
Copy link
Owner

hikerpig commented Jun 4, 2022

@jkanche I've released [email protected] for this feature.

Currently it can not process link target with file extension, see the demo site for information

Could you try to upgrade it to see if it fits your need ?

# in _generator folder
yarn add gatsby-theme-kb@latest

Meanwhile, I am trying to find if there are ways to write unit tests for gatsby plugins, after that I will try to support link with file extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants