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

Flexible links #312

Closed
2 of 3 tasks
srid opened this issue Jul 29, 2020 · 19 comments
Closed
2 of 3 tasks

Flexible links #312

srid opened this issue Jul 29, 2020 · 19 comments
Labels
proposal Proposal with exact spec yet to be fleshed out Zettel Format Anything that affects the structure of the zettel text
Milestone

Comments

@srid
Copy link
Owner

srid commented Jul 29, 2020

Proposal

I propose the following linking syntax (retaining the underlying link URI):

This is current style, and will continue to be supported: <foo>

Proposed default: [[foo]]

Flexible link, that allows setting inner text: [[foo | the foo note]].

This does a couple of things:

  1. Makes the already supported [[..]] style links the default.
  2. Supports overriding the link text, as discussed in Advice on linking by ID / not having note title in the source file #306

Advance linking syntax would look the same, except for the change in the 'wrapper' syntax:

Current: 
- <z:zettels?tag=haskell>
- <foo?cf>

Proposed: 
- [[z:zettels?tag=haskell]]
- [[foo?cf]] or [[foo?cf | a foo note]]

Let's use this opportunity to also support regular Markdown links:

Plain markdown links: 
- [a foo note](foo.md)
- [a foo note](z:/foo)

Something to think about:


Final Proposal and Progress

  • Use [[..]] and [[[...]]] instead of <..> Wiki-style links #351
  • Allow overriding link text in wikilinks, eg: [[ foo | a foo note ]]
  • Regular Markdown links: [a foo note](foo.md)
@srid srid added the proposal Proposal with exact spec yet to be fleshed out label Jul 29, 2020
@vcavallo
Copy link

As far as I can tell so far, unfortunately a lot of these still won't work with vimwiki because it will assume that the bit within the () is a filename and it will fail upon adding any query parameters or anything else.

This proposal will still be an improvement, though, as far as rendering the markup on the web.

@EyebrowHairs
Copy link

Just reporting my test with piped links on Zettlr. It's not an integrated thing, but it kind of works because Zettlr basically just does a search for a match and shows you the relevant matches. Although now I'm testing it using different title words and the search is too broad to find the right match...so the title needs to have at least one matching word with the actual note. Similar with the advanced link syntax, it performs a search, but you would need to delete the query part (?cf) so it can find a match. You could technically still use piped links though, because you can delete anything past the ID if needed to find an exact match. But it's also a bit cumbersome...

Otherwise I might just use MD links (using the filename rather than ID) because that actually works really well on Zettlr. Not sure how advanced linking syntax would work with that though.

Stylistically I feel that it should be the same as a regular note link? If you're talking about how it appears on the web, that is.

@Nadrieril
Copy link
Contributor

I like this!
Zettlr, Foam and TiddlyWiki use [[foo]] links too. TiddlyWiki also supports [[foo|text]]. Vimwiki seems to support it too? Anyways those two don't use markdown so it doesn't matter too much. Obsidian just doesn't support id-based linking.

I'd prefer we used a more wiki-like syntax for special links. Here are three possibilities:

  • we could borrow wikipedia's syntax for special links: [[:Category:Help]]. For example [[:zettels:tag=haskell]].
  • Wikipedia also has magic links like {{ISBN|0-7475-3269-9}} (see here). We could write {{zettels|tag=haskell}}.
  • Another option is what TiddlyWiki does: they use e.g. [backlinks[]] to display backlinks. We could write [zettels[tag=haskell]].

Those syntaxes can easily be extended to support inter-repo links, which we might want one day: [[other-zk:foo]], [[other-zk:zettels:tag=haskell]], {{other-zk:zettels|tag=haskell}}, [other-zk:zettels[tag=haskell]].

I'm not sure what to do about the ?cf links. Maybe [[:cf:foo]]?

@srid srid pinned this issue Aug 3, 2020
@srid srid added the Zettel Format Anything that affects the structure of the zettel text label Aug 4, 2020
@Coda-Coda
Copy link

Coda-Coda commented Aug 4, 2020

I for one would appreciate the ability to have links of the form [A note or description](title.md) as my current Zettelkasten is in this format. I find this format very portable as pretty much any markdown editor supports the format (on PC and on mobile).

It would be awesome to be able to use Neuron without having to sacrifice portability due to the Neuron link format and it would help with future-proofing too.

Seems like an awesome project! I hope to be able to try it out on my own Zettelkasten 🙂

@Coda-Coda
Copy link

Coda-Coda commented Aug 5, 2020

I have realised that it's not too difficult to write a script to switch all Zettels back and forth between [A note or description](title.md) and [[title]] _(_ A note or description _)_ . So much as I would still like the ability to support traditional markdown links, at least I can already relatively easily use Neuron with my existing Zettelkasten - and it seems really cool!

@srid
Copy link
Owner Author

srid commented Aug 7, 2020

@Nadrieril I like the Wikipedia magic links (aren't they called templates?). Something like {{zettels|tag=haskell}} does seem much simpler to type than URIs.

Some thoughts on cf links

In retrospect I should have made cf the default kind of links, with folgezettel links (one that appears in uplink tree) being marked explicitly, with say ?branch. I think implementing this proposal gives us the opportunity to do this:

  • <foo> becomes, say, [[foo?branch]]
  • <foo?cf> becomes [[foo]].

In the Wiki-style proposal, [[foo?branch]] doesn't look very good, so the question becomes: how do we flag the link type (such as branching links)? More generally, how can we specify "link labels" as proposed in #190 (comment) ?

@vcavallo
Copy link

vcavallo commented Aug 8, 2020 via email

@srid
Copy link
Owner Author

srid commented Aug 8, 2020

In the Wiki-style proposal, [[foo?branch]] doesn't look very good, so the question becomes: how do we flag the link type (such as branching links)?

Use triple brackets to denote folgezettel links, eg: [[[foo]]]. This assumes that other Zettelkasten apps will still treat it as a link (albeit with superfluous [...] brackets); it is in fact true for Zettlr.

@EyebrowHairs
Copy link

Use triple brackets to denote folgezettel links, eg: [[[foo]]]. This assumes that other Zettelkasten apps will still treat it as a link (albeit with superfluous [...] brackets); it is in fact true for Zettlr.

Seems like an elegant solution!

I am actually leaning more towards MD-style links now [title](filename.md), simply because it hides the actual filename while giving you the option to title it whatever you want, and because it works on Zettlr :D

Are there any cons anyone can see with that? I'm not sure how compatible it will be with other editors, and it still doesn't help with the cf problem...

@hoschi
Copy link

hoschi commented Aug 10, 2020

The down side of MD-style links is that you need to give it the title yourself. When you change the title of a zettel you would need to update all links and change all files.
With Neuron and the LSP you get all time up to date titles without work for yourself. I would like a way to give it an optional "titel" for links in sentences.
MD-styles are good for the latter case, but should not be the only/default way of linking, in my opinion.

@srid srid added this to the 1.0 milestone Aug 11, 2020
This was referenced Aug 12, 2020
@srid srid mentioned this issue Aug 20, 2020
4 tasks
@EyebrowHairs
Copy link

EyebrowHairs commented Aug 22, 2020

@hoschi Maybe I wrote it down wrong in my example. I would use MD-links to display a different title/appearance than the note's real title, so you are only changing what's displayed, not the actual title of the file.

Example: This is how to [link](how-to-link.md) one note to another note.

But I agree that it shouldn't be the only option!

(Also I tested this out, and it almost works, except when viewing it as a website because it needs to be .../filename.html instead of .../filename.md)

@srid
Copy link
Owner Author

srid commented Aug 22, 2020

[[..]] and [[[...]]] style links are now in master. Next up, we will support [link](how-to-link.md) as well as [[how-to-link | link]].

@vcavallo
Copy link

This is great! Inter-op is already improved now with other wiki-like tools - and the [[how-to-link | link]] feature will only make this even better :)

Thanks!

@srid
Copy link
Owner Author

srid commented Aug 31, 2020

Regular markdown links ([link](how-to-link.md)) are now supported in the master branch. They are treated as "cf" links.


Have we finalized on the [[ foo | a foo note ]] syntax? How does it work with other Zettelkasten apps?

@vcavallo
Copy link

@srid Does this mean that markdown links (with alt titles, as you exemplified above) cannot be branching links?

@srid
Copy link
Owner Author

srid commented Aug 31, 2020

@vcavallo Not sure what you mean by "alt titles". If you define a link like this [link](how-to-link.md) - then the link to how-to-link zettel will be a cf link. In order to make that a folgezettel, you will have to switch to using wiki-style link, i.e., [[[how-to-link]]] or [[[how-to-link | link]]].

@vcavallo
Copy link

Yep, that's exactly what I mean @srid. But do I have it right that the [[[how-to-link | Link Title]]] isn't ready yet? (meaning non-cf, branching links aren't yet possible with link text that differ from the note title).

@srid
Copy link
Owner Author

srid commented Aug 31, 2020

That's right. That's what is left to do for this issue -- see the checklist in issue description further above -- and I'd like to hear from folks using other Zettelkasten apps on the syntax proposed for it before it gets added to neuron.

@srid srid unpinned this issue Sep 6, 2020
@srid
Copy link
Owner Author

srid commented Sep 6, 2020

Moving what's left to #373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal with exact spec yet to be fleshed out Zettel Format Anything that affects the structure of the zettel text
Projects
None yet
Development

No branches or pull requests

6 participants