Local Graph Depth

by Chandra Sivaraman
5
4
3
2
1
Score: 50/100

Description

Open Obsidian local graph views at a configurable default depth.

Reviews

No reviews yet.

Stats

0
stars
1
downloads
0
forks
1
days
2
days
2
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
4
commits

Latest Version

2 days ago

Changelog

First release.

  • Opens local graph views at a configurable depth, 1 to 5, default 2.
  • Collapses the graph controls panel when a local graph opens.
  • Moving the depth slider in the plugin settings re-depths every open local graph.

Install: copy main.js and manifest.json into <vault>/.obsidian/plugins/local-graph-depth/.

README file from

Github

Local Graph Depth

Local graph views always open at depth 1, with the controls panel in the way. This plugin opens them at a depth you choose, with the controls collapsed.

Behavior

  • A local graph you open gets your configured depth, and its controls panel starts collapsed.
  • A pane restored from the saved workspace keeps the depth and controls state it was saved with.
  • Moving the depth slider in the plugin settings re-depths every open local graph at once.
  • Otherwise what you set by hand wins. The plugin touches each pane once as it opens, and applies a depth only when the pane is still at Obsidian's default of 1.

Settings

Default depth — a slider from 1 to 5, the same range as the depth slider in the local graph controls. The default is 2. Set it to 1 to leave newly opened graphs alone.

Collapse the graph controls — hides the settings panel when a local graph opens. The gear icon brings it back. On by default.

Installation

From the community plugin list

Settings → Community plugins → Browse → search for "Local Graph Depth" → Install → Enable.

Manual

  1. Download main.js and manifest.json from the latest release.
  2. Put both in <vault>/.obsidian/plugins/local-graph-depth/.
  3. Reload Obsidian, then enable the plugin in Settings → Community plugins.

How it works

A local graph view carries its settings in the options object of its view state: localJumps holds the depth, close collapses the controls panel. On each layout change the plugin looks for local graph panes it has not seen, and writes the keys it wants through view.setState(). The view hands those keys to its graph engine, which is the same route the depth slider and the close button take, so the controls, the options and the rendered graph all stay in step.

Only getState() and setState() are used, both public API. The options keys themselves are undocumented, but they are the format Obsidian persists in workspace.json. If a future release renames them the plugin stops applying its defaults, and fails quietly: the graph still opens, at depth 1.

Tested against Obsidian 1.8.4.

License

MIT