Zettelkasten Forum


[Plug-in] Append backlinks to the current note

edited November 19 in Plug-In Showcase

This new plug-in is available at https://github.com/BrBorghi/append_backlinks

Once again, there are some hard-coded formats. This could be solved by using a template like in my other plug-in New Note from Template. Maybe later ?

Post edited by ctietze on

Comments

  • @brborghi The link is broken it seems

    Author at Zettelkasten.de • https://christiantietze.de/

  • @ctietze
    Just checked. It works for me. It's true that I have some trouble with links in Github...
    Tell me if the error persists.

  • @brborghi, check to see if you've set the repo to private. Looking at your list of repos, it doesn't show.

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • edited October 16

    @Will
    Good point! The repository is now public.
    I used Github desktop for the first time to create it. There are some gotchas.

  • Ah, I didn't think of that :sweat_smile: Works now.

    I scanned the source code and it appears that you allow for backlinks in the "back matter" (bottom) of the note to also count as a regular link (i.e. you don't exclude them from the matching), which could create circular linkage.

    That's not per se a problem, but maybe this isn't your intention, so let me sketch the situation:

    Imagine note A linking to B (A→B). That's the only 2 notes in your archive, and that's the only link. You placed it deliberately. You look at A and run this plug-in. Nothing happens, there's no incoming link. Now you look at B and run this plug-in. It will add a Backlink pointing out "that A links here" -- with a link to A no less. So now there's B→A, too. If you go to A and run the plug-in again, you now get a backlink entry mentioning B.

    My personal expectation or preference would be to treat machine-added backlinks that live inside of a note's content to not count and be excluded, so the plug-in will never show a backlink when I look at A (because it skips the B→A link in the back matter of B).

    For context check out the discussion on this (much more complex!) tool https://zettelkasten.de/posts/note-link-janitor-andy-matuschak/

    Author at Zettelkasten.de • https://christiantietze.de/

  • My requirements for this append-backlink plug-in were as follows:

    • Respect the KISS principle. The more simple the better for a first release. I'll check if more functionality is needed (for me!) after having using it for a while.
    • Modify only one note at a time, and specifically only the current note, to be sure not to sabotage the whole bunch of notes, and to be able to check immediately the result.
    • Append only. The previous backlinks section is not replaced. No deletion of any text, so that there is no need for an undo. No risk of losing precious content.
    • Some kind of traceability. A timestamp in the backlinks section title let me know the last time I ran the backlink plugin for this note.

    So my choice has been to have only one type of link to match, independently of how the link has been inserted in the note. The consequence is, as you mentioned, that the appended backlinks are processed in the same way that the manually inserted links, leading to generate backlinks in the original file.

    Supposing that B links to A, if we run the plug-in for A and B, B appears as a backlink in A, and A appears as a backlink in B. In B, the link to A appears at least twice: once in the main text, and once in the generated backlinks section.

    In practice, as a note author, I don't mind.

    It would not be too difficult to avoid this behavior. For instance, we could have, by convention, a special syntax for links in the backlink section, such as <[[202410032210]]> (some more brackets), so that the plug-in can recognize them. However, some magic is needed and it would add complexity to the code.

    YAGNI, the XP guys say.

  • This all makes sense, especially for a first release! Thanks for sharing your thoughts on that. It's great to see that you considered all of this already :)

    Author at Zettelkasten.de • https://christiantietze.de/

Sign In or Register to comment.