Package: bear-note-graph
Bear-note-graph 🐻🐍Note: Still WIP, not as thoroughly tested as I would have likedThis is a simple CLI to generate aGraphviz-powered graph of your notes inBear.ExampleThis is an example in PNG format, with the flag--anonymise, which you can use in case you want to show your own graph but avoid showing the titles of your notes¯\﹍(ツ)﹍/¯If you use the default output (PDF) you will get clickable links to notes and tags (BUT ONLY ON iOS, Preview for Mac does not open app links). I recommend you copy your graph to iCloud if you want clicking. You can see an example of the PDFhere(although it is anonymised as well).InstallationYou need an environment with at least Python 3.7, andpipinstallbear-note-graphInstalling graphvizTo generate the graph, thesfdpcommand from Graphviz needs to be available, and for some settings (like, if you want to change overlap modes) you may need to reinstall to addgts. For this, you should havehomebrewavailable.brewuninstallgraphviz--ignore-dependencies
brewinstallgts
brewinstallgraphvizUsageusage: bear-note-graph [-h] [--config [config]] [--dump-config]
                       [--dump-palette] [--anonymise] [--only-tags]
                       [--only-notes] [--debug]

bear-note-graph generates a Graphviz graph of your Bear notes

optional arguments:
  -h, --help         show this help message and exit
  --config [config]  Configuration file to use. Use --dump-config-file to get
                     a sample
  --dump-config      Print the default configuration file and exit
  --dump-palette     Print the default palette file and exit
  --anonymise        Mangle the tags and link names preserving 'look'
  --only-tags        Show only tag links
  --only-notes       Show only note links
  --debug            Set logging to debug levelYou just need to runbear-note-graphafter installing, by default everything will be output in/tmp/.Configuration fileThis is straight from the defaultsgraph:anonymise:False# Make the output anonymousmax_label_length:50# Max length to show of the notes/tagsinclude_only_tags:""# Generate graph only for these tags (comma separated)exclude_titles:"readings,>"# Skip all notes with titles containing this (comma separated)exclude_tags:"journal,@"# Skip all tags containing this (comma separated)show_tag_edges:True# Whether to show tags and the linking between tags and notesshow_note_edges:True# Whether to show note edgesprune:False# Remove all notes with no tags (useful for include_only)overlap:False# Overlap mode for nodes in the graphsep:"+90,90"# Margins around nodessplines:True# Whether to use splines for the arrowsbgcolor:"solarized-dark.base02"# Background colour for the graphfree_form:"K=0.9"# Any additional parameters to Graphviztmp:"/tmp"# Temporary folder for the copy of the Bear SQLite databasedestination:"/tmp/bear_graph"# Default destination for the Graphviz resultoutput_format:"pdf"# Format of the output graphviz (only useful if run_graphviz is set)run_graphviz:"sfdp"# Algorithm to run automatically sfdp or neato recommendedtag:shape:"folder"# Shapestyle:"rounded,filled"# Stylefill_color:"solarized-dark.yellow"# Fillstrike_color:"solarized-dark.orange"# Strokefree_form:""note:shape:"note"style:"filled"fill_color:"solarized-dark.cyan"strike_color:"solarized-dark.blue"free_form:""tag_link:strike_color:"solarized-dark.magenta"arrowhead:"none"# Arrowheadfree_form:"penwidth=\"2.5\""# You can add any additional parametersnote_link:strike_color:"solarized-dark.green"arrowhead:"normal"free_form:"penwidth=\"2.5\""custom_palette_here:# You can inline palettes herescreaming_color:"#AAAAAA"# You can inline palettes hereMost of the configuration parameters are for Graphviz, so check them in theirdocumentation.The Markdown parsingIn case you are curious, I wrote a customMarkdown parser. Because, why not, and I wanted to play with parser combinators. It is not as thoroughly tested as I would like, and it also has issues with blank spaces around the nodes, but for the purpose I wanted it, it works.The anonymisationThis is just so I can show my own graph without showing the tags or note titles. It's based on a relatively good hashing algorithm, and does some tweaking to make it look "realistic".