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

Resolve ambiguities based on closer common ancestor #498

Merged
merged 18 commits into from
Feb 9, 2024
Merged

Resolve ambiguities based on closer common ancestor #498

merged 18 commits into from
Feb 9, 2024

Conversation

srid
Copy link
Owner

@srid srid commented Jan 13, 2024

  • Prototype
  • Do the reverse:
    • "backlinks" should not show all the places linking to [[foo]] (if that foo was an ambiguity resolved)
    • what about uptree? folgezettel parents, etc.
  • refactor

@srid srid mentioned this pull request Jan 13, 2024
5 tasks
@edrex
Copy link
Contributor

edrex commented Jan 18, 2024

I was just looking into how it might be possible to add resolution (nearest ancestor), since I have same-name notes in different directories all over the place, making the current behavior a blocker for using emanote for my big repo. So great to see a patch in progress Srid!

I would prefer that the behavior be to omit descendant search entirely, and search only ancestors (that's what Ikiwiki does), but I don't need that to get unblocked.

I just did a test build and it's still showing ambiguous link errors for me:

Screenshot-2024-01-18-12:56

(out of scope here, the rendering for these inline errors has always seemed broken for me. Missing style or something?)

LMK if you want review when you're ready.

@edrex
Copy link
Contributor

edrex commented Jan 18, 2024

Previous discussion, starting at #115 (reply in thread)

@srid
Copy link
Owner Author

srid commented Jan 23, 2024

I would prefer that the behavior be to omit descendant search entirely, and search only ancestors (that's what Ikiwiki does), but I don't need that to get unblocked.

Without descendant search, it would not be possible to "combine" multiple sites though (see #494), and thus it would break https://community.flake.parts/ (the various docs come from different repos; and guide.md for example exists in both haskell-flake and nixos-flake repos).

@edrex
Copy link
Contributor

edrex commented Jan 24, 2024

I was too ambigious with "... omit descendant search entirely". I meant a ref Foo shouldn't resolve to /A/Foo.md, but (A/Foo) still would. So a ref R from path A would resolve to B if and only if B = Apre + Ref for some Apre in Prefixes(A).

This would require all descending path elements to be explicit in refs. This would allow matching on subdirs for flexible reference remapping (eg, a local site registry mapping ref prefixes to URL prefixes for external sites).

I'm only guessing at the use-case you're working on. Am I missing part of the requirement?

@srid
Copy link
Owner Author

srid commented Jan 26, 2024

@edrex What is the value of Prefixes(A) if A = /Foo/Bar/Qux.md?

If Prefixes == ["/", "/Foo", "/Foo/Bar"], then by the rule you stated above, Qux.md can link to any note in the notebook.

Could you provide a more rigorous logic so I can understand what you are proposing?

@srid srid marked this pull request as ready for review February 9, 2024 15:23
@srid
Copy link
Owner Author

srid commented Feb 9, 2024

I'm gonna merge this now; but will always be happy to revisit the ambiguity resolution algorithm based on convincing rationale.

@srid srid merged commit 9849d42 into master Feb 9, 2024
6 checks passed
@srid srid deleted the amb branch February 9, 2024 15:30
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

Successfully merging this pull request may close these issues.

2 participants