The card-case system needs each card to have a unique and permanent id number. This id is used for finding cross-referenced cards. Leo creates a unique id for each node, so I decided to use this identifier, known as a *gnx*. An example gnx is *tom.20210521095407.1*. This id can be extracted by a bit of code in a script.
Make in last year's thread, I had suggested that our "zettel" cards could be marked up with a bit of Restructured Text. Identifiers and key words, like the id, could be written in RsT's "Field List" format. This would make them easy to parse, and they would display very readably if rendered as RsT.
This format sets off the key word between colons, like this:
:id: tom.20210521095407.1
:seealso: tom.20210321135407.1
:eventdate: 2021-05-21
It also turned out to be very helpful to add the name of target cards to the field list lines, and the name of the node as a header for the card.
With these additions, the body of a card looks like this:
William Collins
----------------
:id: tom.20210520181722.1
:created: 2021-05-20 18:17
:type: person
:tag: Collins Immigration
:marriage: tom.20210605195824.1 `Collins-King`_
:born: ~1615
:died: 1687
Born in Maidstone, Kent County, England. Died at Isle of Wight County, VA.
Immigration Into America
^^^^^^^^^^^^^^^^^^^^^^^^^
William Collins emigrated from Kent County, England to King and Queen County, VA in 1635 aboard the ship "Plain Jane".
The two underlines tell RsT to render the previous line as different title levels. They are optional but look good in a RsT rendered view of a larger part of a tree of cards.
The backticks followed by an underscore are an optional markup that lets an RsT processor turn them into clickable links to the target. They do not add much visual clutter, and allow for navigation in a rendered browser view.
A rendered view of a card or a subtree can be had using the Viewrendered3 plugin. This plugin can also export the rendered HTML to your browser.
The attached Leo outline contains the little scripts I use, together with the key bindings I use for them. You would put them into the @settings tree of your card-case outline, or into MyLeoSettings.leo if you want them available in all outlines.
The two most used commands are zettel-convert-card (F8) and zettel-go-to-target (F9). When you select a node and press F8, the current node will be converted into a zettel card. This means that the node headline is inserted with its underline as the title, and the id and date fields are also inserted.
When you select or put the cursor on a field list line that contains a gnx as the second field, the selection jumps to the target card. This makes navigation extremely fast and easy.
Almost as important is zettel-goto-with-backlink (F6). This jumps to the target node like F9 but also inserts a backlink to the sending card if the target does not already have one. If the target has a backlink but the backlink line does not contain a label, the script will insert the sending card's title as the label.
Since backlinks are a key feature of any zettelkasten system, this script makes generating them accurate and nearly painless.
The new backlink will be inserted as the first line of the target node, with the generic name :link:. You probably will want to move the line somewhere else, and to replace the string `link` with something more appropriate. But even if you don't, navigation will still function normally.
The command zettel-copy-gnx (F7) lets you easily copy a card's gnx to the clipboard so you can paste it into another card as a target. Then F6 will take you to that target and insert a backlink. Another F6 will add the target's label to the link line of the sending card. Now both cards have been labeled and equipped with mutual backlinks.
Pleas note that my original F8 script from last year had a bug that sometimes inserted an incorrect gnx. Also, it created entire new car, but I find my new way of converting an existing node to be easier and quicker.
To summarize this navigation system, the field list lines like
:link: gnx label
let you navigate to any crosslinked card within a leo outline, and the optional RsT label/backtick/underscore markup lets you navigate in a rendered view displayed in a web browser.
You can also use any of Leo's search capabilities to search through the cards. I find the Nav pane to be especially good for this.
In my next post, I will cover ways to get your data out of Leo if you need to. It can be very simple.