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

Proposals: deep links and block embeds #105

Closed
wants to merge 2 commits into from

Conversation

jevakallio
Copy link
Collaborator

@jevakallio jevakallio commented Jul 13, 2020

By @riccardoferretti and @jevakallio

We discussed about some potential near future enhancements to the linking experience, and agreed that there are a couple of additional features that would be cool:

  • Deep links: Support and autocompletion for linking inside a section in another note
    • This could involve defining custom sections other than just markdown headings (we have a few different syntax proposals to consider -- new ideas welcome)
    • Main reason for custom sections is block embeds aka. block transclusion,
  • Block embeds: The idea where instead of simply linking to a section, we bring it inline to the other document as VS Code Peek Definition pane, and also in the generated HTML side (this presumes build step).

These are in addition to the work @digiguru is doing with supporting [[Loose Matching Links]], and the spike I'm doing to autocomplete links based on File Headings instead of file-names.

@jevakallio jevakallio requested a review from jojanaho July 13, 2020 19:07
Copy link
Contributor

@jojanaho jojanaho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, hadn't really thought the topic this thoroughly before! One thing that would be nice to understand better is what does the editing experience look like for the user? Would the anchor tags be inserted automatically based on text lookup result in autocompletion?

What comes to syntax, I'd like it to be non-existant :D. Since we don't have database but just markdown files, that's a bit hard as you well know. The next best thing could be the standard html anchor: <a id="auto-generated-id-here"></a>? With MDX this could maybe be e.g. <a auto-generated-id-here></a> or even <a auto-generated-id-here /> (markdown preview in VS code seems to not like the latter). For blocks, I like your thinking of block boundary / another a / heading / eof.

Still the last stab on the "non-existant syntax", which might be a bit too wild. One could define a text search that matches one of the blocks (e.g. referring the previous paragraph with something like [[?but just markdown files]]). This would work as long as there's no duplicate text fragment within a file AND the fragment is not modified / deleted. These again could be detected with linting.

Anyway, I don't have objections for merging your current files into master.

@mathieudutour
Copy link
Contributor

Just going to chim in with how Roam is doing it:

  • each bullet (or in Foam case, paragraphs) has an id
  • a block is referenced with ((block-id)). It is replaced by the block content. Writing (( opens the autocomplete to find the block to reference

Each block is actually a page on its own, with a link to its parent at the top.

@jlongster
Copy link

@mathieudutour How is the block-id generated in Roam? The first couple words of the block?

I'd love block links, don't care as much about block embeds, if it makes sense to just do linking first.

@mathieudutour
Copy link
Contributor

No it’s an opaque uid which stays constant regardless of the content (it’s the id of the node in the db)

@jevakallio
Copy link
Collaborator Author

Closing in favour of foambubble/rfcs#3

@jevakallio jevakallio closed this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants