Zettelkasten Forum

[FEATURE REQUEST] Outliner view of a zettel and its children

edited June 2019 in The Archive

After thinking about zkviz and my workflow, I realised that one feature would be particularly useful or me: the ability to have an outline view showing all the "children" of a chosen zettel ("children" just meaning the zettels that the chosen zettel links to), and optionally their children as well, and their children, and so on – preferably in the current note list.

Maybe this could be implemented by a specific command in the search bar like "outline(Zettel-ID)(depth=3)" or something similar, which would then result in a note-list where children are indented (ideally with an option to fold/unfold individual children lists).

For now, I would be quite happy with just the first part: Having a command that results in a list of the chosen zettel, its children, their children and so forth. I could then copy and paste this list into my outliner software (OmniOutliner), indent zettels according to their children relations there and then freely move them around. Would that be easy to implement @ctietze?


  • This particular outlining feature is not on my task list, but I do think the upcoming scriptability milestone will enable us all to figure out how to script stuff like this. The functionality The Archive will expose can change in the process, and we'll have to be careful to not bloat the app.

    Maybe a functionality to return a list of links for any given note would be all you need: then the script can start with currentNote, request all links and get linkList1; then for each item in linkList1 request all links again, etc. for as many levels as you want. Does The Archive need to supply this functionality, or are we all better off if the scripts implement their own link finding process? We'll see!

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

  • @ctietze: That sounds good and sensible – looking forward to the Scriptability-feature!

  • edited September 2019

    I solved this problem with a (quite long) KM macro. It will ask for the desired level up to which you want the children to be shown and then depending on your choice either produce a note that shows the children-hierarchy of a selected zettel in The Archive or in OmniOutliner (the latter allows to fold and unfold). I won't post an image of the macro here because it is quite long and the user case is very special, but anyone who is interested can download it here. For the gsed command in it to work, you need to install GNU-sed (e.g. with brew install gnu-sed). You possibly also need to create the variable ENV_PATH in Keyboard Maestro's Preferences -> Variables and set it to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.

    The output looks like this if you choose to display it with The Archive:

    And like this if displayed with OmniOutliner:

  • That is a very nice-looking result, @Vinho! Congrats! :) Hope writing this stuff will get much easier when the scripting API is implemented.

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

  • @ctietze: I don't really know what that means or will be like, but am still very much looking forward to it ;)

  • Hello there! I've been trying to get this working this afternoon to no avail. I believe I've followed the instructions above, installed the appropriate dependents, etc. There are no obvious errors or messages or anything like that – it's simply that the results are always childless. Can I ask whether this is still functional for others? And if so, please help! Thanks in advance.

  • @mjknght: Still works for me. Are you using OmniOutliner or The Archive to display the results? Maybe you could post an image of a note you tried it with?

  • @Vinho, thanks for your response!

    Here's the note I tried it with:

    # 202004150946 Hub 1
    Link 1: [[202004150947]]
    Link 2: [[202004150949]]
    Hub 2: [[202004150948]]

    I tried it with both OmniOutliner and The Archive. In the former the result is:

    Hub 1 (thearchive://match/202004150946)

    And in the latter:

    Children of: Hub 1 [[202004150946]]

    Which is to say, the children in the note don't seem be picked up. Thanks in advance for any advice you're able to give!

  • @mjknight: The macro should create a log-file (~/Dropbox/Zettelkasten/-visualisation/logco.txt) that makes it easier to identify why it's not working. Can you find that file for a note you tried it with?

  • @vinho: Yes, sure, here's the contents of that file:

    Children Outline of Zettel “202004150946 Hub 1”

    Level 0

    202004150946 Hub 1
    Finding children for Zettel: 202004150946 Hub 1

    • All links processed.
      Current preOutline:
      Children of: Hub 1 [[202004150946]]
  • @mjknight: How are your zettels named in your Dropbox folder? Do they have the .md file extension?

  • edited April 2020

    @vinho: A ha! That's the issue – sorry to have been so dim. They are .txt files rather than .md, and once I changed that, of course everything worked as expected. I really appreciate the help with troubleshooting this.

    It’s such a useful tool, as well as another way of tackling a scenario @ctietze picked up on the other day: Idea for a script to make structured link lists easier to browse.

    I wonder if I could trouble you with a further query? Though I anticipate it might just be too involved. I also want to use this macro and one or two others like it on sets of notes that do not have the 12-digit identifiers. (Pardon the heresy.) Alas, try as I might, I am just not adept enough with all this to reverse engineer that. Of course, some of this macro's complexity arises from doing clever things by separating out those identifiers, and ironically, a macro that just worked on the basis of note names would be a lot simpler. But I am struggling to unpick what's going on in order to create a simplified version. Do you by any chance have a version of this macro or your visualisation macro (Visualising Links between Zettels with Keyboard Maestro and Graphviz) that takes the note names without that extra widgetry? Or if not, could you by any chance give me a steer as to how to remove those elements from the macros?

    A pinch of context: I'm a lecturer in the humanities with a growing body of notes used in teaching, research and writing. I am an enthusiastic dabbler on the technical side, but this particular challenge has very much defeated me.

    Thanks again for your help!

  • @mjknght: Glad it works now!

    Regarding your other query: Unfortunately I don't have much time at the moment and that seems like a bigger project to think through – I don't have version of the macro that do what you want. What I find very convenient about using UIDs is that links are very easy to set up, they don't clutter the zettel like a complete title would and you can change zettel titles without destroying links to the corresponding zettels. I wouldn't want to miss out on all of this...

  • edited April 2020

    That’s more than understandable, @Vinho – very grateful for your help, all the same. I’ll keep trying to tackle it.

    As for UIDs: lots of sparky discussion about it all on the forum just lately! I've only been able to read parts of it.

    I certainly take the point about the durability of UIDs – particularly because, in the way I work at the moment, I take the note titles seriously as headlines of the notes’ contents, and will from time to time rephrase them to better encapsulate that and also as the contents evolves. But then again, having put in the work to make those titles so functional, I prefer to see that phrase at a glance wherever a link to the note appears. In effect, for the way I work at the moment, the complete title is the very opposite of clutter. And so, when titles do change, I get around the issue of broken links by a find and replace on the notes folder. Because I don't tend to create links outside the Zettelkasten, that's been enough to keep the show on the road.

    None of that speaks against also using UIDs of course! And I guess my reservation about using them (other than wanting to force myself to always see the title phrases) is simply that I always want to use the titles anyway, and so it feels like the UIDs are cluttering them! An aesthetic point, perhaps, and I guess that your visualisation and note children scripts find another way around that issue by removing them from the output? In any case, envy of these utilities may well drive me to embrace the UIDs yet, even if they don't serve the same purpose in my case!

    I have the impression that Luhmann didn’t have a title-and-body approach – just his numbering and straight to the contents? Of course he would only use the UIDs in creating links… So perhaps I am departing from that too.

    Anyway, thanks again for your help! And for the utilities you've shared – they really are handy.

Sign In or Register to comment.