# Rene's SublimeText for Zettelkasten - Package, Talk and more

• @kjxymzy wrote
[...] Perhaps YYMMDDHHMMSS [...]

@rene wrote
[...] I'll try to fix all the regexes and magic number twelves for now...

Done.

Readme not updated yet but the new setting (default=false: 12-digit IDs) is:

    // seconds in note IDs?
// if true : YYYYMMDDHHMMSS 20171224183045
// if false: YYYYMMDDHHMM   201712241830
"seconds_in_id": true,


Plugin will start using 14-digit IDs as soon as you change the setting to true. It will then cope with mixed 12- and 14-digit IDs.

• @rene said:
[...] binary configurable. Either 12 or 14 ('seconds or not'). No fancy stuff in between. It's meant to be a timestamp.

I wonder how long that will hold true. Maybe in the future we will have collaborative, distributed Zettelkästen and encounter all sorts of collisions between different users. Anyone fancy a blockchain?

• I don't want to be a heretic but I just change them manually afterwards.

I am a Zettler

• @sfast said:
I don't want to be a heretic but I just change them manually afterwards.

You are, of course, allowed to do that - and to be heretic - if you wanted. It's what I do, too. People with different habits probably benefit from a long note ID. If you're not used to 12-digit IDs, you most likely won't even question 14-digit IDs. But I won't make them default, for heredity's sake

• @rene said:

@sfast said:
I don't want to be a heretic but I just change them manually afterwards.

You are, of course, allowed to do that - and to be heretic - if you wanted. It's what I do, too. People with different habits probably benefit from a long note ID. If you're not used to 12-digit IDs, you most likely won't even question 14-digit IDs. But I won't make them default, for heredity's sake

Im already usin' da 14 digit IDs.

Already enjoying using this a lot

• Hi there, as requested from 517qf per Github issue, image preview now supports pandoc-like size attributes.

#### Per image preview size

You can define a specific preview size per image by adding image attributes inside a pair of curly braces as shown below:

![xxx](img/zettelkasten-book-de.jpg){width=100% height=100%}
![xxx](img/zettelkasten-book-de.jpg){width=200px height=200px}



Note:

• SublimeText requires you to specify both width and height when you specify your own attributes.
• SublimeText seems to have its own interpretation of how big a pixel is
• If you don't want to manually convert width and height to scaled values, then just use percentages. Start with 100% for each and take it from there.

Merry Christmas to you all

• Merry Christmas

Wanted to chime in regarding the image attribute syntax: usually they are simply appended to the part with the file name; here an example of both variants:

![xxx](img/zettelkasten-book-de.jpg width=200px height=200px)
![xxx][yyy]

[yyy]: img/zettelkasten-book-de.jpg width=200px height=200px


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

• edited January 2018

Hi... Just discovered ZK (both the plugin and the method)
while looking for something like nvAlt but using only Sublime.
Looks promising and I'm excited to try it out

New to all this so not sure if this is bug or something I'm doing wrong...

I'm not seeing any syntax highlighting for tags in the documents.
and when I search with #-! the .search_results.md is empty.

Note: when I search with #-? I do get a list to choose from showing tags from other files which have been saved

Details:
Windows,
Sublime 3.
"Markdown Zettelkasten" displayed in lower right corner
I don't have many packages installed at yet..
But PlainNotes and PlainTasks are two which could be messing with style...
EDIT: I don't have silver search installed, trying to use default.

ZK.PNG 10.2K
• The line

## Comment


is actually misleading -- it's a level-2 heading. Comments would be written as <!-- comment -->

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

• Yes.. good point. Not in the habit of using markdown that much (yet), and my context switch from Linux shell scripting wasn't fully suspended...

• edited January 2018

@rene This is a brilliant extension to ST3. I'm really enjoying it. Thank you for making this super useful package. I have a question. Do you think it'd be possible to modify the [[ ]] Wiki search to look for additional note IDs? I use a batch script I made to import annotations from PDFs that I read. Because it's so fast (< 1s to import all notes), the 14-digit ID is not sufficient to uniquely name the files. So I modified the name to add a sequential .1, .2, .3,. So one of my notes is titled 20180113180214.1 The origin of oligodendrocytes is unclear.md

I've never modified an ST3 package before, but if I were to dig around in the .py file, where might I go? would this even work?

Similarly, if I wanted to change the tag symbol to @ as opposed to #, could I do that?

Thanks!

• @achamess said:
@rene This is a brilliant extension to ST3. I'm really enjoying it. Thank you for making this super useful package. I have a question. Do you think it'd be possible to modify the [[ ]] Wiki search to look for additional note IDs? I use a batch script I made to import annotations from PDFs that I read. Because it's so fast (< 1s to import all notes), the 14-digit ID is not sufficient to uniquely name the files. So I modified the name to add a sequential .1, .2, .3,. So one of my notes is titled 20180113180214.1 The origin of oligodendrocytes is unclear.md

I've never modified an ST3 package before, but if I were to dig around in the .py file, where might I go? would this even work?

Similarly, if I wanted to change the tag symbol to @ as opposed to #, could I do that?

Thanks!

Actually, I'm realizing that the [[ ]] can find those notes, but it's more a matter of the scope of the search. I keep those different notes in a subdirectory of my ZK. So it can find those notes when I'm in that directory explicitly. So I guess the question is, can I change the scope of the search to look inside subdirectories?

• @ctietze said:
Merry Christmas

Wanted to chime in regarding the image attribute syntax: usually they are simply appended to the part with the file name; here an example of both variants:

![xxx](img/zettelkasten-book-de.jpg width=200px height=200px)
![xxx][yyy]

[yyy]: img/zettelkasten-book-de.jpg width=200px height=200px


Thank you for sharing this. Had I known this earlier . Another Multimarkdown vs pandoc thing. I am happy with the way it is now, though. But I'll keep it in the back of my mind...

• @CEC said:
Hi... Just discovered ZK (both the plugin and the method)
while looking for something like nvAlt but using only Sublime.
Looks promising and I'm excited to try it out

New to all this so not sure if this is bug or something I'm doing wrong...

I'm not seeing any syntax highlighting for tags in the documents.
and when I search with #-! the .search_results.md is empty.

Note: when I search with #-? I do get a list to choose from showing tags from other files which have been saved

Details:
Windows,
Sublime 3.
"Markdown Zettelkasten" displayed in lower right corner
I don't have many packages installed at yet..
But PlainNotes and PlainTasks are two which could be messing with style...
EDIT: I don't have silver search installed, trying to use default.

Hey, just catching up with things; had to "hide" for a while.

Regarding syntax highlighting: I usually install the Markdown Extended package and maybe it just never occurred to me that this might be the foundation on top of which my added syntax highlighting bases. Syntax highlighting is split into 2 parts: Color Scheme and Syntax. If you use the provided syntax highlighting and don't get proper highlights, then it's because your SublimeText lacks basic Markdown parsing. Some people like Multimarkdown, I prefer (out of habit) Markdown Extended. Give one or even both of them a try.

Regarding Search: .search_results.md is only used when you have ag installed. I highly recommend installing it no matter how pure you want to be. #? and #! behaviour defaults to pre-ag mode which gives you pop-up lists and in my eyes is much inferior to how it works with ag. It's entirely possible that tags from other files in the working directory will show up when not using ag as this is old code that I haven't really maintained too well and never noticed or cared about that behaviour myself...

When time permits I can dig into all of this, I will actually because the package should work as "advertised", but I better not promise anything as of now.

• @achamess said:

@achamess said:
@rene This is a brilliant extension to ST3. I'm really enjoying it. Thank you for making this super useful package. I have a question. Do you think it'd be possible to modify the [[ ]] Wiki search to look for additional note IDs? I use a batch script I made to import annotations from PDFs that I read. Because it's so fast (< 1s to import all notes), the 14-digit ID is not sufficient to uniquely name the files. So I modified the name to add a sequential .1, .2, .3,. So one of my notes is titled 20180113180214.1 The origin of oligodendrocytes is unclear.md

I've never modified an ST3 package before, but if I were to dig around in the .py file, where might I go? would this even work?

Similarly, if I wanted to change the tag symbol to @ as opposed to #, could I do that?

Thanks!

Actually, I'm realizing that the [[ ]] can find those notes, but it's more a matter of the scope of the search. I keep those different notes in a subdirectory of my ZK. So it can find those notes when I'm in that directory explicitly. So I guess the question is, can I change the scope of the search to look inside subdirectories?

Hey cool stuff you are doing here! Will you share your PDF extraction? Maybe just for inspiration of others who want to achieve similar things?

Regarding the note ID format: I haven't tried this yet but I believe you when you say the IDs themselves seem to work. I was just worried about the dot and the length; affects syntax file and some regular expressions in the .py. But if linking and opening via link works without any code change, even better

Regarding recursing into sub-directories: I will have a look. This is probably a bit trickier but it should certainly be doable. (He said )

• @rene said:

@achamess said:

@achamess said:
@rene This is a brilliant extension to ST3. I'm really enjoying it. Thank you for making this super useful package. I have a question. Do you think it'd be possible to modify the [[ ]] Wiki search to look for additional note IDs? I use a batch script I made to import annotations from PDFs that I read. Because it's so fast (< 1s to import all notes), the 14-digit ID is not sufficient to uniquely name the files. So I modified the name to add a sequential .1, .2, .3,. So one of my notes is titled 20180113180214.1 The origin of oligodendrocytes is unclear.md

I've never modified an ST3 package before, but if I were to dig around in the .py file, where might I go? would this even work?

Similarly, if I wanted to change the tag symbol to @ as opposed to #, could I do that?

Thanks!

Actually, I'm realizing that the [[ ]] can find those notes, but it's more a matter of the scope of the search. I keep those different notes in a subdirectory of my ZK. So it can find those notes when I'm in that directory explicitly. So I guess the question is, can I change the scope of the search to look inside subdirectories?

Hey cool stuff you are doing here! Will you share your PDF extraction? Maybe just for inspiration of others who want to achieve similar things?

Regarding the note ID format: I haven't tried this yet but I believe you when you say the IDs themselves seem to work. I was just worried about the dot and the length; affects syntax file and some regular expressions in the .py. But if linking and opening via link works without any code change, even better

Regarding recursing into sub-directories: I will have a look. This is probably a bit trickier but it should certainly be doable. (He said )

Hey @rene
Thanks! Yeah, recursing into other subdirectories is the thing that would be great. Right now, the [[ ]] does indeed find notes with my dot notations but only other notes in the same directory, if that makes sense.

Another question - Is there any way to change the tag notation? I understand the hashtag is popular, but I don't like how it's too close to markdown headers. I might prefer to use @ instead of #.

My script is on Github. But if you mean you want to see a note, here is what it looks like:

You can see the note here. The title of the note is a Unique ID + a one-line summary that I create while annotating in Skim.app.

That summary also gets placed inside the text.

The script also pulls my Bibtex key from Papers3.

Overall, my script is much less general now (requires Papers3 and Skim) but is more useful to my workflow. But anyone could amend it to work with more workflows.

I'm a very amateur coder at best, but it's incredible the power of what one can do with a little Python, Command Line and Applescript!

And here in lies another reason to use plain text. There are countless tools for working with text. You can do anything.

• First of all, take you all. Zettelkasten and this apps are so helpful that I don't have words...

Anyway, I'm having a little issue. I saved my zettel project in OneDrive, and ag stopped work. Outside OneDrive, ag work well, but with that project it simply open some prompt screen in a flash, but it does not create a file nor show the results. If I uninstall ag, sublime text just to the job well. Some thoughts?

• @nelsonsntn said:
First of all, take you all. Zettelkasten and this apps are so helpful that I don't have words...

Anyway, I'm having a little issue. I saved my zettel project in OneDrive, and ag stopped work. Outside OneDrive, ag work well, but with that project it simply open some prompt screen in a flash, but it does not create a file nor show the results. If I uninstall ag, sublime text just to the job well. Some thoughts?

Solved. Turns out AG don't work well with paths that contain words with accents.

• Hi sublime_zk users!

After a bit of silence, I got the chance to work on some GitHub issues and requests, thanks to @achamess and @wangeleile and @merlinthered.

So it's time for another

### Creating a new note and link from selected text

There is a very convenient shortcut to create notes from selected text and automatically inserting a link to the new note, replacing the selected text: Just select the text you want to use as note title before pressing [shift]+[enter].

This will bring up the same input field at the bottom of the window, this time pre-filled with the selected text. When you press [enter], a new note will be created, using the selected text as its title. In addition, the selected text in the original note will be replaced by a link to the new note.

The following animation illustrates this:

### Inserting a citation

If your note archive contains one or you configured a .bib file, then you can use the shortcut [@ or [# to insert a citation. Which one you use depends on your preferences, whether your prefer pandoc or multimarkdown.

A fuzzy-searchable list of all entries in your bibfile will pop up, containing authors, year, title, and citekey. To select the entry you like, just press [enter]. To exit without selecting anything, press [esc].

When you made your choice, a citation link will be inserted into the text: [@citekey] (or [][#citekey] if you use MultiMarkdown style).

The following animation shows this in action:

• edited February 2018

@achamess said:
Actually, I'm realizing that the [[ ]] can find those notes, but it's more a matter of the scope of the search. I keep those different notes in a subdirectory of my ZK. So it can find those notes when I'm in that directory explicitly. So I guess the question is, can I change the scope of the search to look inside subdirectories?

I hear you, @achamess

Support for subfolders has just been added.

• @achamess said:
@rene This is a brilliant extension to ST3. I'm really enjoying it. Thank you for making this super useful package. I have a question. Do you think it'd be possible to modify the [[ ]] Wiki search to look for additional note IDs? I use a batch script I made to import annotations from PDFs that I read. Because it's so fast (< 1s to import all notes), the 14-digit ID is not sufficient to uniquely name the files. So I modified the name to add a sequential .1, .2, .3,. So one of my notes is titled 20180113180214.1 The origin of oligodendrocytes is unclear.md

I tested this and checked the code. While it appeared to work without change to the plugin, it didn't really work in all cases: When following a link (to open the note) 20180113180214.1 it would 'randomly' open any of the 20180113180214.n notes (the first one it found).

This is fixed now, also the highlighting supports your note id style now.

• Huge thanks to @rene. He made this tool even more powerful and helpful to me. Now I can search in subdirectories and the package accommodates my unique ID format. This is the best ZK tool I've ever used. Keep up the great work @rene.

• I just finished reading How to Take Smart Notes after your recommendation and got my ST3 setup. In one word: "Awesome!" Thank you, @rene so much for developing this tool. I can't wait to start building my Zettelkasten with it. I'm committing to adding 10 notes a day.

Where is the best place for bug reports/feature requests/best practices?

• edited February 2018

I just finished reading How to Take Smart Notes after your recommendation and got my ST3 setup. In one word: "Awesome!" Thank you, @rene so much for developing this tool. I can't wait to start building my Zettelkasten with it. I'm committing to adding 10 notes a day.

Hey @heychad! Great you like it, that's very nice to hear! 10 notes a day sounds like a lot of progress. But I feel you; when I started I had a lot of "catching up" to do...

Where is the best place for bug reports/feature requests/best practices?

That's actually 3 questions in one

I suppose bug reports best go straight to github.

Feature requests: You can open issues on github for your feature requests (one issue per request), as other users have done. But it has also proven useful to just share them here where it would often result in a fruitful discussion for the benefit of us all. So either way is fine. It's up to you; whatever is most comfortable for you is fine with me.

Best practices: So if you want to share them I don't have a dedicated forum for that (yet?). But we can use this forum and if it gets substantial or the posts become too scattered to be useful, I can set up a wiki on github. So far I didn't have the time to better document / showcase / provide best practices. But contributions are welcome, the more the better. I am also open to suggestions other than the github wiki. @ctietze also probably has good ideas how to go about that.

Hope this was useful, happy zetteling (I'm not trying to coin a new word here )

• We're happy to host discussions here! No need to keep everything in this single thread, by the way.

Also, if your package should attract a cult following, @rene, we can always open a dedicated category for ST3 plugin related discussions to group things together.

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

• @ctietze said:
We're happy to host discussions here! No need to keep everything in this single thread, by the way.

Thank you, Christian, for this generous offer. I also appreciate it when all Zettelkasten related stuff can have a single home here. Makes most sense.

Also, if your package should attract a cult following, @rene, we can always open a dedicated category for ST3 plugin related discussions to group things together.

Haha, yeah, that was also my biggest worry: creating a cult following . But glad you even have that case covered . Thanks again!

• Hi there,

As requested by @achamess we have a new feature (for the lazy ones among us ): Creating note overviews by #tag:

### Inline expansion of #tags

Another workflow for producing overview notes is by #tag. So if you want to produce an overview note referencing all notes tagged by a single tag, cust press [ctrl]+[.] while the cursor is inside a #tag. This will produce a bulleted list of notes tagged with the #tag.

The following animation shows inline expansion of #tags in action:

• Aaaand inspired by the above, we can now do the same with citekeys that we can with note-links and #tags! So I guess it's time for another

#### Searching for notes referencing a specific citekey

In order to be able to search for all notes citing the same source, just like note-links and #tags, citation keys can also be "followed" by pressing [ctrl]+[enter].

Note: This works with @pandoc and #multimarkdown style citation keys and is independent of whether the citekey is part of an actual citation ([@citekey] or [][#citekey]) or just occurs in your text as @citekey or #citekey.

As usual, if you have ag installed, as is recommended, this will make the most sense, because search results will show up in the external search results, as is illustrated by the following animation:

### Inline expansion of citekeys

In order to produce an outline of all notes citing a specific source, just press [ctrl]+[.] while the cursor is inside a citekey. This will produce a bulleted list of notes containing a reference to the citekey.

Note: This works with @pandoc and #multimarkdown style citation keys and is independent of whether the citekey is part of an actual citation ([@citekey] or [][#citekey]) or just occurs in your text as @citekey or #citekey.

The following animation shows inline expansion of citekeys in action:

• @heychad just had a brilliant idea: in addition to @wangeleile 's requested feature to create a new note with a title from selected text, he suggested to create a note with both title and body from a multiline selection. Sounds confusing?

### Creating a new note and link from selected text

There is a very convenient shortcut to create notes from selected text and automatically inserting a link to the new note, replacing the selected text: Just select the text you want to use as note title before pressing [shift]+[enter].

This will bring up the same input field at the bottom of the window, this time pre-filled with the selected text. When you press [enter], a new note will be created, using the selected text as its title. In addition, the selected text in the original note will be replaced by a link to the new note.

The following animation illustrates this:

As a bonus feature, you can even select multiple lines and create a new note complete with title and body:

• the first selected line will become the note's title
• all the other selected lines will become the note's body (text).

The ideas you all come up with to make Zettelkasten work more efficient are really amazing! Thanks for the great suggestions!

• I just implemented timestamp formatting for new note id templates.

Time for another ...

### New Note templates

If you need further customizing of how your new notes should look like, you can define your own template:

In your package's settings (user) just put in a line like this:

  "new_note_template": "---\nuid: {id}\ntags: \n---\n",


To produce new notes like this:

---
uid: 201711150402
tags:
---


The format string works like this:

• \n creates a new line.
• {id} : the note id like 201712241830
• {title} : note title like Why we should celebrate Christmas
• {origin_id} : the id of the note you came from when creating a new note
• {origin_title} : the title of the note you came from when creating a new note
• {file} : the filename of the note like 201712241830 Why we should celebrate Christmas.md
• {path} : the path of the note like /home/reschal/Dropbox/Zettelkasten
• {timestamp: format-string}: the date timestamp formatted by format-string, see [below]

origin might need a bit of explanation: When you are in note 201701010101 and create a new note via [shift]+[enter] or via [[implicit note creation via title]], the new note will get a new id, maybe 201702020202. Its {id} therefore will be 201702020202 and its {origin} will be 201701010101.

#### Date and time formatting options for timestamp

Directive Meaning Example
%a Weekday as locale’s abbreviated name. Sun, Mon, …, Sat (en_US); So, Mo, …, Sa (de_DE)
%A Weekday as locale’s full name. Sunday, Monday, …, Saturday (en_US); Sonntag, Montag, …, Samstag (de_DE)
%d Day of the month as a zero-padded decimal number. 01, 02, …, 31
%b Month as locale’s abbreviated name. Jan, Feb, …, Dec (en_US); Jan, Feb, …, Dez (de_DE)
%B Month as locale’s full name. January, February, …, December (en_US); Januar, Februar, …, Dezember (de_DE)
%m Month as a zero-padded decimal number. 01, 02, …, 12
%y Year without century as a zero-padded decimal number. 00, 01, …, 99
%Y Year with century as a decimal number. 2017, 2018, …
%H Hour (24-hour clock) as a zero-padded decimal number. 00, 01, …, 23
%I Hour (12-hour clock) as a zero-padded decimal number. 00, 01, …, 12
%p Locale’s equivalent of either AM or PM. AM, PM (en_US); am, pm (de_DE)
%M Minute as a zero-padded decimal number. 01, 02, …, 59
%S Second as a zero-padded decimal number. 01, 02, …, 59
%j Day of the year as a zero-padded decimal number. 001, 002, …, 366
%U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 00, 01, …, 53
%W Week number of the year (Monday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 00, 01, …, 53
%c Locale’s appropriate date and time representation. Tue Aug 16 21:30:00 1988 (en_US); Di 16 Aug 21:30:00 1988 (de_DE)
%c Locale’s appropriate date representation. 08/16/88 (None); 08/16/1988 (en_US); 16.08.1988 (de_DE)
%% A literal % character. %
##### Examples for note id 201802261632:
• {timestamp: %Y-%m-%d %H:%M}: 2018-02-26 16:32
• {timestamp: %a, %b %d, %Y}: Mon, Feb 26, 2018

To produce a YAML note header (for pandoc), like this:

---
note-id: 201802270019
title:  Date Test
author: First Last
date: 2018-02-27
tags:
---


you can use the following settings:

// when creating a new note, put id into title?
// false to disable
"id_in_title": false,

// Template for new notes
"new_note_template":
"---\nnote-id: {id}\ntitle: {title}\nauthor: First Last\ndate: {timestamp: %Y-%m-%d}\ntags: \n---\n",