Hey there!
tldr; I wanted to test-drive a small (graph-view) idea I had before making an official feature request, so I started poking around my local install to make it work. As a result, my graph-view works better for me now than before
Background
I wanted the graph view to adjust the size of nodes based only on the amount of backlinks to that note. Currently, node size is based on outgoing links and backlinks. Hereās how itās currently working and Google BackRub approach for reference.
Process
To change the javascript to test out this feature, I extracted my local installation, edited the lines of code I figured would achieve my result, repackaged the installation and reloaded my running Obsidian app.
After the intitial set up, the workflow is good enough to poke around and test things out quickly.
Result
It works! Yay! My graph-view now renders nodes based on their backlinks only.
Hereās a before and after picture to illustrate with a sample data vault:
Before with default rendering where the āIndex Noteā has the same size as the āAuthority Noteā:
ā¦and after editing where only the āAuthority Noteā has more weight because of its backlinks:
Iām very happy with how it helps me view the graph. When running it against my personal vault, the topography changes for the better for me. Far less noise from index notes. It helps me discover what notes have, over time, become the real āauthoritiesā or important topics in my mind-space. That wasnāt possible before.
Hereās the workflow in detail for MacOs:
Detailed workflow
- Install development dependencies (MacOS)
# Install asar for extracting and re-packaging app
$ brew install npm
$ npm install -g asar js-beautify
$ cd ~/Library/Application\ Support/obsidian
# Note: Your version number may very well differ
$ cp obsidian-0.8.2.asar obsidian-0.8.2.asar.bak
# Extract source
$ asar extract obsidian-0.8.2.asar obsidian-0.8.2
# Beautify obfuscated/minimized js for easier editing
$ js-beautify obsidian-0.8.2/app.js -o obsidian-0.8.2/app.js
- Open
obsidian-0.8.2/app.js
or other files with an editor of your choice. - Make the edits you want to make.
- Repackage the app after youāve made your change:
$ asar pack obsidian-0.8.2 obsidian-0.8.2.asar
- Then, in Obsidian, reload the app with
ā R
. - Check out how your changes work.
- Rinse and repeat from step 3 to step 6
Note: After updating to a newer version, existing changes will be lost unless you start tracking versions somehow on your own.
Hope this is interesting and still counts as a (maybe even nifty) hack.