Bidirectional interlinking?

I’m trying to use DEVONthink as the basis for a Zettelkasten (using markdown files with references to source materials which are mostly PDFs), but I’m growing increasingly frustrated with the friction involved in interlinking two or more items. Any suggestions? (Insert girlfriend meme with me ogling Roam.)

2 Likes

Friction in what way?
DEVONthink isn’t specifically built for doing Zettelkasten and there are surely variations on the theme within that community as well. So specific questions would be helpful.

Friction in the sense that I end up having to do a lot of flipping back and forth between the notes I want to link and copying and pasting their URLs. I suppose wiki links would get me most of the way there, but then I’d risk losing all of my links if DT goes away another 10 or 20 years down the road. (Just this week the developer of an app I’ve been using for years announced that it would not be updated for Catalina, so I’m extra-sensitive to that right now.) For me one of DT’s biggest selling points was that notes are retrievable as files inside the database, so I can recover anything if I ever need to. I’ve played around with giving each note a UUID and basing the links on those, or using file URLs, but I haven’t figured out a convenient way to grab those without the flipping back and forth. I could probably cobble something together with AppleScript, but I’m hoping someone’s already done that work for me! :slight_smile:

I’d guess you’ll be doing something completely differently in 10 to 20 years :stuck_out_tongue: :wink:

Sure, but I’ll probably still want access to at least some of the knowledge that I’m organizing today.

If longevity is a priority, I think it’s important to include the note‘s ID in the note‘s body text. Should DT be gone, you could at least perform a search to find your note connections.

Wiki links may help so that other software can make sense of it. The drawback is that these links usually break if you rename your notes. So x-devonthink-item:// links (which use the note‘s unique ID) seem more robust. But, as mentioned, finding link connections via search requires that a note also includes its own ID in the note body.

Keyboard shortcuts
or a script may indeed help to ease the editing/insertion process but I haven‘t tried this yet.

I am not sure I understand how you are linking your notes. Still, I will share something that could perhaps be useful.

This is an adaptation of the script Christian wrote after I posted a Keyboard Maestro macro to create a new MD note with the selected text as name via ⌘L shortcut.

As you can imagine I ditched the macro and sticked with to an adapted version of the script.

The main differences are:

  • if there is no text selected, instead of throwing an error, it will ask you for the nome name.
  • when it asks for the note text, it will already have the clipboard content set as the default answer.
  • it will insert the name of the note whence it was created as a keyword in the body of the note. To me this is the same as inserting a backlink, since I use auto linking mode. If you don’t, it should be easy to adapt to insert the proper MD link using the note’s UUID.
  • it will open the new MD file in a new tab on the same window.
tell application id "DNtp"
  try
    if not (exists think window 1) then error "No window opened."
    
    -- Adquirir variáveis primárias
    set currentRecord to (content record of think window 1) -- Record ativo
    set theOrigin to name of currentRecord -- Nome do record ativo para backlink
    set theGroup to parent 1 of currentRecord -- Grupo do record ativo para local da nova nota
    
    -- Usar texto selecionado como nome
    try
      set invalidName to false
      set theName to selected text of think window 1
      if theName is "" then set invalidName to true
    on error
      set invalidName to true
    end try
    if invalidName then set theName to display name editor info "Insert note name" -- Em caso de erro, solicitar nome
    
    -- Solicitar texto da nota. Padrão é clipboard.
    set theContent to display name editor info "Insert note text" default answer the clipboard
    
    -- Inserir return link
    set theBLC to {"true", "false"}
    set theBL to choose from list theBLC with prompt "Insert backlink?" default items {"true"}
    set theBLR to item 1 of theBL -- Resultado da escolha
    
    -- Texto da nota com return link
    if theBLR is "true" then
      set theMD to "# " & theName & return & return & "Keywords: " & theOrigin & return & return & theContent & return -- Reunir todo conteúdo da nota

    -- Texto da nota sem return link
    else if theBLR is "false" then
      set theMD to "# " & theName & return & return & "Keywords: " & return & return & theContent & return -- Reunir todo conteúdo da nota
    end if
    
    -- Criar novo record
    set theResult to create record with {name:theName, type:markdown, content:theMD} in theGroup
    
    -- Abrir novo record em uma aba na mesma janela
    open tab for record theResult in think window 1
    
    -- Msg de erro
  on error error_message number error_number
    if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
  end try
end tell

I severely dislike using random uuids to identify my notes. But I guess this script could work with this as well, but I am not sure.

1 Like

I’d recommend to solve problems as they appear (re longevity))

As for the connections it highly depends on if Zettelkasten is scriptable and has unique IDs for its docs (I don’t know this app). Further question is what connection you want: one-to-one or one-to-many.

I’ve found the fastest method is editing in Markdown, then option-dragging the desired item into the item I’m editing. DT automatically creates a Markdown-formatted link with the dragged item’s title and x-link.

This thread may have some more useful info, particularly the discussion around backlinks, which is I think what you’re referring to:

2 Likes