Zettelkasten Forum


How do you do that cool link per line formatting thing?

This is a super silly question, but I'm going to wonder until I ask.

Every once in a while I see a screenshot, I think it's usually @sfast, with links that look like

This is a great note ................................................[[201901091407]]
This is a note that's even better ...................................[[201901091408]]

My question is, are you putting all of those ... in by hand and laboriously hand-crafting these, or is there some KM or other software trick you're using? It just looks so cool.

Comments

  • @mediapathic said:
    My question is, are you putting all of those ... in by hand and laboriously hand-crafting these, or is there some KM or other software trick you're using? It just looks so cool.

    YES, IT LOOKS COOL @ctietze. :smiley: :smiley: :smiley:

    @mediapathic I have a snippet "qdot" turn into "...................." That makes it a bit easier. Other than that it is per hand. But it is really worth it when it comes to more complex structure notes. And it goes into muscle memory pretty fast. :smile:

  • @sfast said:

    YES, IT LOOKS COOL @ctietze. :smiley: :smiley: :smiley:

    I sense I have walked in on an ongoing debate...

    @mediapathic I have a snippet "qdot" turn into "...................." That makes it a bit easier. Other than that it is per hand. But it is really worth it when it comes to more complex structure notes. And it goes into muscle memory pretty fast. :smile:

    Thanks! I'll probably build that in Alfred and then add it to my list of why I should actually just by Keyboard Maestro. I'm going to have to name it something different though as I have a friend named qdot.

  • It is not debate. I'd say that it is a one-sided butchering. But Christian will deny that fact I think. :smile:

    A friend named qdot? What language? Or nickname?

  • Hi!

    or is there some KM or other software trick you're using? It just looks so cool.

    I had the same thought, but was too lazy to set up a Keyboard Maestro macro. But after your post I finally created a macro.

    It will only work if all your notes are in the same folder and contain "# 201901131856 Title" in the first line, that is a "#" sign, followed by a blank, followed by a twelve digit number, followed by a blank, finally followed by the title of the note.

    If you select text that contains a twelve digit ID in every line and invoke the macro, every line will be transformed to a new line starting with the title, followed by dots, followed by the id in double brackets. In the following gif, the macro ins invoked twice.

    The lines may contain more characters than only the twelve digit id, these characters will be overwritten.
    At the top of the macro, you have to set the path to your notes and the number of characters every line should have.

    Cheers!

    PS: I just noticed I can't upload the macro file, the forum tells me the file type is not allowed. Can we do something about that, @sfast?

    dots.gif 797.1K
  • @cdguit Try a zip of the .kmmacros XML file. (Also maybe a screenshot like it used to be to reassemble :))

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

  • @ctietze Alright, the zip file seems to work. Thanks :smile:
    Should I link this post in the "The Archive and Keyboard Maestro" thread?

  • Sure, go ahead! You may also create a new discussion with details so people asking for changes or help have a place to go.

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

  • edited January 22

    @sfast said:

    A friend named qdot? What language? Or nickname?

    Nickname. He wrote the teledildonics package for emacs.

    That's not a typo [nsfw github link].

  • @cdguit said:
    Hi!

    or is there some KM or other software trick you're using? It just looks so cool.

    I had the same thought, but was too lazy to set up a Keyboard Maestro macro. But after your post I finally created a macro.

    Lovely! Thanks very much. I inch closer to buying KM... The main thing that stops me is that The Archive is the only software I ever use with text other than emacs, which has its own powerful macro and snippets methods. So I'm not sure it's worth $40 for an Archive extension...

  • @mediapathic hold on to your wallet.

    Here is my take on using a Keyboard Maestro macro to insert “…” to left justify the name of a note and right justify the permanent link. Look in the script (two places) to see where you can adjust the line length from 80 characters to whatever you want.

    This macro really does two things. It presents a list of the notes that can be searched. Multiple notes can be selected. It also separates the note title out of the link making it editable without losing the appropriate link.

    Now I’m working on a macro that will create backlinks. An important but tedious task.

    Default style

    [[201901081238 - Querying the archive]]
    [[201901110943 - Requirements for Diagrammatic Knowledge Mapping Techniques]]
    [[201901110947 - Limited working memory]]
    [[201901081224 - Disorder]]
    [[201901081238 - Querying the archive]]

    After triggering the macro (Control L in my case), you are presented with a blank “Prompt with List” dialog box where you type to search then select appropriate notes.

    This is what the results will look like.
    They are then filled in at the cursor in a The Archive note.
    SOME NOTES WITH DOT FORMATTING APPLIED

    Requirements for Diagrammatic Knowledge Mapping Techniques Long [[201901110943]]
    Limited working memory .........................................[[201901110947]]
    Knowledge visualization ........................................[[201901110957]]
    Personal Knowledge Management recipient ........................[[201901111005]]
    Linking to prior knowledge .....................................[[201901111020]]
    Niklas Luhmann’s Zettelkasten ..................................[[201901111024]]

    Inset Note Link with 80 spacing

    Sample of actual summary note.

    Will Simpson
    kestrelcreek.com

  • Very nice @Will! Thanks for sharing.

  • edited January 24

    Nickname. He wrote the teledildonics package for emacs.

    That's not a typo [nsfw github link].

    Why does it not surprise me that emacs has a "teledildonics" package? :smiley:

  • @mediapathic Sometimes there are discounts on Keyboard Maestro, maybe you can take advantage of one of those. And sometimes it is included in Mac Software Bundles. Keep in mind that Keyboard Maestro can do much much more than just extend The Archive, so if you enjoy automation and if you are willing to dig into it, I would highly recommend to give it a try.

    @Will Thank you for your contribution. I still prefer my own macro, since it allows me to select lines already containing Zettel IDs so I can easily update these lines.
    One slightly OT question though: Do you know of any way to select multiple entries of a Keyboard Maestro list by just using the keyboard and no mouse?

  • @cdguit said:
    @mediapathic Sometimes there are discounts on Keyboard Maestro, maybe you can take advantage of one of those. And sometimes it is included in Mac Software Bundles. Keep in mind that Keyboard Maestro can do much much more than just extend The Archive, so if you enjoy automation and if you are willing to dig into it, I would highly recommend to give it a try.

    Oh yeah. I had the free trial for a while and really enjoyed it. It's just that mostly the only programs I have open these days are Emacs, a browser, and The Archive, so it effectively becomes all about The Archive, because Emacs has its own mechanisms for automation.

  • Anyone have any idea how to write the relevant string manipulation in bash?

    I'm trying to figure out an Alfred alternative to this KM macro, and am stuck.

  • @micahredding said:
    Anyone have any idea how to write the relevant string manipulation in bash?

    I'm trying to figure out an Alfred alternative to this KM macro, and am stuck.

    oooooh it didn't occur to me that I could do complex things like this in alfred. My wallet may be saved!

    I look forward to your results.

  • @micahredding said:
    Anyone have any idea how to write the relevant string manipulation in bash?

    I don't have Alfred, so what's the input you're working with? Do you have a string for the current line already? If you share a couple of sample input strings this should work with, we can surely figure something out!

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

  • edited February 6

    @ctietze said:
    I don't have Alfred, so what's the input you're working with? Do you have a string for the current line already? If you share a couple of sample input strings this should work with, we can surely figure something out!

    Alfred allows you to run bash scripts which take a "file filter" input. So you can create a filter for all your Archive notes, and search through them. This gives you an input string like this:

    User/me/.../Archive/123456789101 My note.txt

    A bash script can then process that in various ways. My existing script looks like this:

    echo -n $(basename "{query}");

    (Where {query} is the input)

    And the output of that is this:

    123456789101 My note.txt

    I've tried a number of things to process this further into some version of the formatted link, with no luck.

  • edited February 7

    Try this:

    $ echo "123456789101 My note.txt" | sed -E 's/^([0-9]+) (.+)\.txt$/"\2" "\1"/' | xargs printf "%-80s[[%s]]\n" | sed 's/  / ./g'
    My note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [[123456789101]]
    
    1. echo "123456789101 My note.txt" is the test input
    2. sed -E 's/^([0-9]+) (.+)\.txt$/"\2" "\1"/' extracts the ID at the start and the file name up until the file extension and reverses the order in which they are displayed (output: "My note" "123456789101", with quotation marks to group the filename into 1 string)
    3. xargs before the printf command transforms the output of (2) into parameters to the command that follows:
    4. printf "%-80s%s\n" prints the first argument ("My note") padded with spaces up to a length of 80 characters, then prints the second argument ("123456789101"), sans quotation marks, surrounded by square brackets (output: My note [[123456789101]])
    5. sed 's/ / ./g' _s_ubstitutes double spaces with a space and a dot, _g_lobally in the input

    Problem is the ID is appended to the 80 character string. If you know you will use 12-character-wide Ids only, you can reflect this by subtracting 12 + 4 (for the brackets) from 80 in the printf command, e.g.

    $ echo "123456789101 My note.txt" | sed -E 's/^([0-9]+) (.+)\.txt$/"\2" "[[\1]]"/' | xargs printf "%-64s%s\n" | sed 's/  / ./g'
    My note . . . . . . . . . . . . . . . . . . . . . . . . . . . .[[123456789101]]
    

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

  • Thanks so much, @ctietze!

Sign In or Register to comment.