-
Notifications
You must be signed in to change notification settings - Fork 673
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
Proposal: Link Definition and Disambiguation #122
Conversation
Co-authored-by: Mathieu Dutour <[email protected]>
## Current status | ||
|
||
- We generate link ref defs from wiki-links inline | ||
- Wiki links are expected to be the full source of truth, but we don't have enough information to conclusively disambiguate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slapping comments here just by reading this from top to bottom, at this point got a question "disambiguate what"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a disambiguation to this disambiguation :)
|
||
Let's say we have two documents in the workspace with the same title "Some Title" | ||
|
||
- We would have autocompletion base on title of the document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could autocomplete always be done with a combination of title and file path within the workspace - in a style of "My title - foo/bar/my-title.md"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Added this now.
Let's say we have two documents in the workspace with the same title "Some Title" | ||
|
||
- We would have autocompletion base on title of the document | ||
- This generates a link (typically a title, but could also have e.g. `:2` to disambiguate multiple links in the same file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would prefer the local links to use style [[foo/bar/my-title]] - would this be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojanaho, to clarify, do you mean you prefer foo/bar/my-title
for just the disambiguated links in case of title conflicts, or always?
It could be configurable, since it's an arbitrary label. Options could include:
- file-name.md
- Title Cased File Name
- Document Title
- Arbitrary Label you write yourself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always, since in my case it would improve readability - e.g [[book-summaries/war-and-peace]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And to be exact, we have the freedom for arbitrary labels only when link ref defs are in use :)
- They would look like this: | ||
``` | ||
[[Some File]] | ||
[[Some File:2]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so to disambiguate between the two or more title-cased wikilinks within a document. I think this solution would be okay if user wants to use title-cased wikilinks, which would lock them into link ref defs. Again personally I'd still like to use file paths to disambiguate - in many cases it could also be more readable (e.g. [[active/master-plan]] - [[obsolete/master-plan]] vs [[Master Plan]] - [[Master Plan:2]]
If links are being revamped let's explicitly support aliasing too, something like |
Wouldn't note aliases be in the note frontmatter? Or do you mean alternative title for a link? |
Alternative title for a link is a good way of putting it. For example, say I have a file called It's easier to read and allows the text to flow more naturally. |
I'm not very opinionated either way, but if we're talking about reading-friendliness, I'd rather put the bit that's meant to be read up-front: "you must first [[integrate:integration-methods]] this equation" -- that way my eyes can jump to the end of the block once I hit the delimiter. Same could be achieved with syntax highlighting too. Just thinking out loud. |
@jojanaho and I had a discussion about this. I'm dropping our rough notes here, will integrate these as part of the proposal when I have time, but for now just to get @riccardoferretti up to speed. Ideally, we would like to be able to support both style links
Now, I don't want to play the "please everyone" game, but I feel like these are both completely valid use cases, and I think actually not very complicated to implement: Write time
Read timeThis same logic should work when constructing a graph, and when resolving the link target (e.g. Cmd+Click following the link):
I think we need to do a bit more thinking about this, but this would be an ideal outcome, if it doesn't introduce too much complexity. Conceptually this makes perfect sense, when you think of link reference definitions as disambiguations. If the link doesn't require a disambiguation, it could be "autoreferenced", i.e. not have a link ref def The setting for this could be something relatively user friendly, like: "linkFormat: title | path". |
I regret to say this, but I think we need to write a specification :) It doesn't need to be a formal document, but I think it should pull together a few currently disparate pieces of work:
I can work on this earliest next week, but if anyone else wants to take a stab of pulling a draft of such a specification document together, that would be fantastic and I can provide inputs for it -- just don't have concentrated time to work on it. |
I started to work on this, just first trying to write down all the aspects to consider |
Closing in favour of foambubble/rfcs#3 |
Masterstroke idea by @riccardoferretti! Super excited about this.
This is fully compatible with the existing Link Reference Definition Improvements proposal, with the exception that with this plan, it's no longer feasible to set
LinkReferenceDefinitions: Off