Zettel Composer: a tool for combining notes
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
§ [] to denote a "public" reference to a note to be printed;
> [] for the insertion of notes containing quotes or fragments;
> [] :: [] 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.
It looks like you're new here. If you want to get involved, click one of these buttons!
Very useful. Thank you for this code. Despite your disclaimer, it's also very much worth studying for Python technique.
GitHub. Erdős #2. CC BY-SA 4.0.
@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.
My peak cognition is behind me. One day I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
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.
Thank you! If you really want to get into functions (and parenthesis), try Lisp! It's also an interesting adventure.
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.pywithout any arguments (maybe import argparse), but I will clone the updates.
GitHub. Erdős #2. CC BY-SA 4.0.
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.
Thank you for your message! It just reminded me to update the README.