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:

    I am a Zettler

  • @Sascha 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?

    I am a Zettler

  • 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, @Sascha?

    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 • https://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 • https://christiantietze.de/

  • edited January 2019

    @Sascha 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
    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

  • Very nice @Will! Thanks for sharing.

  • edited January 2019

    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 • https://christiantietze.de/

  • edited February 2019

    @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 2019

    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 • https://christiantietze.de/

  • Here's a Keyboard Maestro macro that takes input from The Archive (ID title without file extension) so you can insert links like @Sascha does:

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

  • @ctietze said:
    Here's a Keyboard Maestro macro that takes input from The Archive (ID title without file extension) so you can insert links like @Sascha does:

    Hi! I don't really understand how the trigger works. :/ That is, how to launch the action.

  • In this case, when you type the 4 characters: ..ln

    It requires you have a list of links (e.g. from The Archive's Copy Links function) in your clipboard.

    (I also have the macro in a macro group that only works for some apps, so that it doesn't trigger in e.g. Messages.)

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

  • @Will said:
    @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.

    No matter what I do I cannot get any of these 'note link' KM Macros to work... the Note List search bar pops up but there are no results no matter what I type- I've re-checked to make sure I have the right directory and even tried changing directories- anyone thoughts on what the problem may be?

  • edited September 2020

    @orice, the variable 'zettelkastenNoteLink' is not finding any notes.

    Try this -

    Change the Execute Shell Script action.

    cd /Users/orice01/Documents/Notes\ \(The Archive\)/ ls | sed -E -e 's/.[^.]*$//' -e 's!^([0-9]+)[[:space:]-]+(.+)!\2 [[\1]]!'

    This should get you into the right directory.

    Spaces and bracket have to be 'escaped' in a Execute Shell Script action. (Also required if you run command in terminal to test.)

    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

  • Ahh thank you! That makes sense, thank you for the quick reply and for kindly excusing my ignorance!

  • @Will said:

    Sample of actual summary note.

    So I've finally purchased the often recommended Keyboard Maestro, and it's a game changer! Special thanks to @Will and others for sharing all the KM macros throughout the years.

    I have one question: is there a way to modify the macro to include a single space character before the [[ or a way to delete the space before the dots? I know this is just stylistic, but it would be great (for those of us with OCD, haha) to have the choice to have a space on either side of the string of dots or no space at all. Something like as follows:

    Text...............[[UID]] (i.e., no space characters on before or after)

    or

    Text ............. [[UID]] (i.e., with space characters before and after)

    I Googled and tinkered for an hour and a half, but couldn't get either to work. Anyone have any ideas to accomplish this? Any help will be much appreciated!

  • @Darryl, sorry you suffer from OCD. It must be hard. The macro in question Inset Note Link with 80 spacing was one of my earlier (01/2019) Keyboard Maestro macros, and I leaned on the Keyboard Maestro forum for help. I got help from a Perl expert, which I'm not, and just took his suggested code and used it even though I didn't understand the syntax.

    Sorry, I can't help. If you find a solution, I'd love to hear.

    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

  • @Will said:
    @Darryl, sorry you suffer from OCD. It must be hard.

    'Twas a joke; no need for such a somber tone. :)

    Sorry, I can't help. If you find a solution, I'd love to hear.

    No prob. Thanks for getting back to me anyway. I actually managed to stumble upon a workaround which seems to be working. I incremented the maxLineLen by one beyond what I want (I use 72 so I adjusted each of the two instances to 73). I also incremented the two instances of $1 to $2. Although the string accounts for +1 max line width, the +1 increment of $1 took out the space and the line is maxed out at 72. I dunno, but it works. Good enough for me.

    So, these changes resulted in the first option which I was looking for (no space characters before or after).

    Thanks again for providing the macro!

Sign In or Register to comment.