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

[Feature Request] Dynamic block to insert backlink content #452

Open
skissue opened this issue Oct 3, 2024 · 5 comments
Open

[Feature Request] Dynamic block to insert backlink content #452

skissue opened this issue Oct 3, 2024 · 5 comments

Comments

@skissue
Copy link
Contributor

skissue commented Oct 3, 2024

Currently, there is a denote-backlinks dynamic block to insert links to backlinked notes, and a denote-files dynamic block to insert the contents of notes matching a regexp. Would it be possible to have a dynamic block to insert the contents of backlinked notes?

@protesilaos
Copy link
Owner

protesilaos commented Oct 4, 2024 via email

@skissue
Copy link
Contributor Author

skissue commented Oct 5, 2024

An aside here. My concern with all these dynamic blocks is that we need to define a whole new function and register it with Org to get the intended behaviour. It seems inefficient, especially when we want to have these kind of combined results that you describe. Maybe there is a way for us to have something more generic here that lets the user compose a query with the desired output style. The building blocks are there but we need to do the research to find out what is missing.

Perhaps it would be worthwhile to combine all the dynamic blocks into a single type with arguments for choosing a query and output filter. An interface like this:

#+BEGIN: denote :query "_regexp" :output links [other arguments]
#+END:

#+BEGIN: denote :query backlinks :output content [other arguments]
#+END:

This could also allow users to easily add their own selection/output methods that could then be hooked in, e.g. via a customizable alist mapping symbols to functions.

@protesilaos
Copy link
Owner

protesilaos commented Oct 9, 2024 via email

@skissue
Copy link
Contributor Author

skissue commented Oct 10, 2024

This makes sense. It will be a major rework though. The important part is to maintain backward-compatibility, as there will be lots of those blocks in users' files and we do not want to break anything (I do not want to make users rewrite potentially hundreds of blocks).

I agree that backward compatibility is of the utmost priority. However, since there's currently no denote block type, there should be no problem with adding one. The old dynamic block functions can then be refactored to use the APIs from the generic block type, specifying the relevant parameters; e.g. denote-files can be a thin shim that passes its parameters into the relevant denote block parameters.

@protesilaos
Copy link
Owner

protesilaos commented Oct 11, 2024 via email

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

No branches or pull requests

2 participants