This repo enable a user of zk to export their graph and create a visual representations of the connections between their notes.
This repo borrow heavily from zetteltools in term of concepts.
I did migrate the code to go so that it may one day be included with zk but also becase I am learning go ;-)
Some things I did add:
- ability to
pipedirectly the output ofzk graphto the script so that it can generate a file - using go
tmplto generate the content as this is standard ingo - use the latest
d3version (version7) at the time of this writing (disclaimer: I have zero experience withd3but ... I also want to learn!) - include an option to serve the file directly using
htttp/serveras this is included ingo
Becaue of this, I don't want to use any module unless the benefits would be huge.
- Add more parameters to the template in particular the size of the
d3canvas, thestrengthof the various forces. Most certainly in a configuration file in the.zkdirectory? - Keep the first
200charcters of the content of each note to offer a preview when clicking on a node? - If possible, being able to open a
notefrom the Web launching the default editor formarkdowncontent - Embed the default template
- Add an option to chose another
tmplfile to make this code more versatile - Tests (zero tests for now!)
- Open the browser with the correct port when launching the webserver (+option to deactivate this behaviour)
for now:
go install github.com/bligneri/zk-graph/cmd/zk-graphthis will give you the zk-graph binary and you can now start using it.
zk graph -t daily --format=json > /tmp/zk-graph/my_notes.json
zk-graph -in /tmp/zk-graph/my_notes.jsonYou can now see the graph on your browser
zk graph -t daily --format=json | zk-graph -in -=> It will pipe the outcome of the zk graph command directly to the zk-graph utility and this file will be server by the webserver
The Webserver is watching the content of /tmp/zk-graph directory and will serve a file directly (if there is a single file)
or show the directory content (if there are multiple files)_
./zk-graph --serverThe webserver will fail if there is no *.html to serve