# Zettel Composer: a tool for combining notes

Dear friends,

After about a year of personal experiments, I present you the "Zettel Composer", a script for combining Zettelkasten notes in a variety of situations: browsing annotations, publishing a book or a paper, assembling a handout for lectures or conferences etc.

Among the nice features, the ability to "watch" files for changes and Marked 2 preview:

The experiments led me to extend the (already not universally accepted standard of) wiki link notation. This was mainly because, first, of the need to differentiate between "public" and "private" notes; and then to provide for some special behaviour depending on the different use-cases. I came to invent things like § [[1234]] to denote a "public" reference to a note to be printed; > [[1234]] for the insertion of notes containing quotes or fragments; > [[1234]] :: [[1235]] for parallel, bilingual texts. I tried my best to give appropriate documentation of these features in the project's README.

Please excuse the fact that the code is a bit messy. This is not only the result of a long process of back-and-forth experimentation but because this project was also the personal attempt to learn some Python of someone inexperienced with the language.

This project had some of its initial inspiration in books like this (V. Goldschmit's Le système stoïcien et l'idée de temps. Paris, 1953):

You may clone the project or copy the script from GitHub.

• Very useful. Thank you for this code. Despite your disclaimer, it's also very much worth studying for Python technique.

Erdős #2. ZK software components. “If you’re thinking without writing, you only think you’re thinking.” -- Leslie Lamport. Replies sometimes delayed since life is short.

• @brunoc, excellent. Adventuring in learning python over the last few months gives me an appreciation of the Herculean work involved in what you've accomplished.

You used a bunch of functions, and that seems the python way. I'm still learning how best to use them.

I use Visual Studio Code as my IDE, and when I open zettel-composer.py, VSC reports a few "Problems." Might this be because I'm using python 3.9?

I'll have to try and figure out what each function does before I can dissect the code.

Will Simpson
“Read Poetry, Listen to Good Music, and Get Exercise”
kestrelcreek.com

• edited January 16

@Will said:

I use Visual Studio Code as my IDE, and when I open zettel-composer.py, VSC reports a few "Problems." Might this be because I'm using python 3.9?

Hello, Will. Python3 seems to be pickier with indentation. I tried to correct some space/tab craziness so that the script should now run with both Python versions 2 and 3.

• edited January 16

@Will said:
@brunoc, excellent. Adventuring in learning python over the last few months gives me an appreciation of the Herculean work involved in what you've accomplished.

You used a bunch of functions, and that seems the python way. I'm still learning how best to use them.

Thank you! If you really want to get into functions (and parenthesis), try Lisp! It's also an interesting adventure.

• @ZettelDistraction said:
Very useful. Thank you for this code. Despite your disclaimer, it's also very much worth studying for Python technique.

Thank you! I'll try to polish the code when I have some time. But I'm glad to know it may be minimally readable already.

• @brunoc I had the same indentation trouble with python 3.8 as @Will. I corrected these (for fun in my own repository), but I hit a runtime error, probably because I ran zettel-composer.py without any arguments (maybe import argparse), but I will clone the updates.

Erdős #2. ZK software components. “If you’re thinking without writing, you only think you’re thinking.” -- Leslie Lamport. Replies sometimes delayed since life is short.

• @ZettelDistraction said:
@brunoc I had the same indentation trouble with python 3.8 as @Will. I corrected these (for fun in my own repository), but I hit a runtime error, probably because I ran zettel-composer.py without any arguments (maybe import argparse), but I will clone the updates.

Yes! The script requires one argument: the file name for the index note. All parameters are optional.

Thank you for the reference to argparse. It seems to be the good way to document usage. For now, I've made the script raise an error when called without an argument.

Otherwise, I tested it with Python 3.9.7 after the tab/spaces clean up -- should be working now.

• I just came across your script. It works really well, and I anticipate it being very useful. Thank you for sharing.

• @marlowe said:
I just came across your script. It works really well, and I anticipate it being very useful. Thank you for sharing.

Thank you for your message! It just reminded me to update the README.