Note Relatives

unlisted

by Abdulrahman S. Al-Batati

Show a note's parent, siblings, children, counterpart and property relations as links, drawn from its frontmatter.

Updated 22d agoMIT
View on GitHub

Note Relatives

Breadcrumb-style links from frontmatter, at the top of every note: its parent, the notes beside it and below it, its counterpart in another language, and any list property read both ways, such as requires and required by. A light way to see a vault's hierarchy, kept in one property, up.

A note in Obsidian: under its title and properties, its parent Linear algebra, the notes beside it and the notes below it

Using it

Give a note a parent in its frontmatter:

---
up: "[[Linear algebra]]"
---

Open the note, or any note in the same family, and its relatives are drawn under its title and properties, in Live Preview and in reading view. There is nothing to paste into a note and nothing to set up:

  • ▲ the parent, the note named by up;
  • beside: the notes with the same parent;
  • below: the notes whose parent is this note;
  • ⇄ the counterpart, the note named by counterpart, for notes kept in two languages or two versions;
  • a warning when the parent is not a note.

A click opens a note, Ctrl-click (Cmd-click on macOS) opens it in a new tab, and hovering with the same key shows a preview. A long row shows 24 links and counts the rest. The relatives are drawn from an index of parents and relations that the plugin keeps up to date one note at a time, so opening a note never scans the vault; when another note's frontmatter changes, what is on screen is drawn again.

The same note in a dark theme

Where it draws

Where to draw, in the settings, is either at the top of every note (the default) or only where a block is. A block puts the relatives at a place of your choosing in one note: run the command Insert relatives block, which writes this right after the note's frontmatter:

```relatives
```

A note that holds a block shows the block, never the header as well.

The command Open relatives panel shows the active note's relatives in the right sidebar, for a theme or a layout where the header does not suit you, or for a note with no room at the top.

Relations, bilingual notes, and where a note is taught

Three notes: a concept with its relations and where it is taught, its Arabic counterpart drawn right to left, and a clipping with no parent

Relations. Any list property can be a row, either the note's own list (requires) or the same list read the other way (required by: every note whose requires names this one). Set them up under Relations listed by the note and Relations naming the note.

Right to left. A note whose language property is a right-to-left language (ar, fa, he and ur by default) is drawn right to left, with its own labels and its own home note. Any label left empty for right-to-left notes falls back to the ordinary one. With a counterpart, each note of a bilingual pair links the other.

Where a note is taught. A relation read the other way can also say where. Give it a section heading, such as Concepts it teaches. In each linking note, the list item under that heading which links this note is read for a place:

WrittenShown
- [[Eigenvalues]] 12:40 or 1:02:03Lecture 21 · 12:40
- [[Eigenvalues]] [12:40](https://…)Lecture 21 · 12:40 and a ▶ link to the video
- [[Eigenvalues]] p. 82, pp. 82–84Book ch. 5 · pp. 82–84
- [[Eigenvalues]] sl. 74Lecture 21 · sl. 74

With short names on, a note called Lecture 21 - Eigenvalues and eigenvectors is shown as Lecture 21.

And three small rows. A home note linked first on every note; routed to, for a note with no parent, the notes its chosen properties link; and badges, a word shown when a property holds a value, such as axiom when axiom: true.

Why this and not Breadcrumbs

Breadcrumbs is the plugin to use for trails, tree and matrix views, diagrams, Canvas, and transitive rules that infer relations from other relations. If that is what you want, use it.

Use Note Relatives for one light row of links under the title, read from up and the properties you name, with little to configure and nothing to rebuild; for bilingual vaults, where each note links its counterpart and is drawn in its own direction; and for study vaults, where a concept says which lecture or chapter teaches it, with the time, page or slide.

Settings

SettingDefaultWhat it does
Where to drawat the top of every noteOr only where a note holds a block.
Block namerelativesThe code block's language. A change takes effect when the plugin is reloaded.
Parent propertyupNames a note's parent; children and siblings follow from it.
Counterpart propertycounterpartNames the same note in another language. Empty hides it.
Language propertylanguageHolds a note's language code.
Right-to-left languagesar, fa, he, urTheir notes are drawn right to left.
Show siblings, Show childrenonThe two rows the parent gives.
Links per row24A longer row counts the rest.
Home note, and one for right-to-left notesnoneA note linked first on every note.
Excluded foldersnoneTheir notes are nobody's child or sibling: a templates folder, for one.
Properties for a note with no parentnoneShown as one row when a note has no parent.
Relations listed by the notenoneRows of what a note's own list properties link.
Relations naming the notenoneRows of the notes whose list names this one, with an optional section that says where.
BadgesnoneA word shown when a property holds a value.
LabelsEnglishEvery row's label, and its right-to-left counterpart.

Every setting appears in Obsidian's settings search.

Upgrading from 1.0

An install that already has settings keeps drawing as it did: only where a block is, under the block name it had (nav was the default before 1.1). Choose at the top of every note in Where to draw to get the header.

Obsidian keeps no settings file for a plugin whose settings were never changed, so a 1.0 install that never opened them cannot be told from a new one. It draws at the top of every note after the update, and its nav blocks show as plain code blocks until Block name is set to nav.

Privacy

The plugin makes no network requests, and writes nothing into your notes except a block you insert yourself with Insert relatives block. Its settings live in its own data.json, written the first time it runs. It reads frontmatter from Obsidian's metadata cache. It reads the text of the notes open in tabs, to see whether they hold a block, and, for a relation with a "where" section, of the notes that link the one on screen.

Installing

From Settings → Community plugins, once it is listed there. Until then, copy main.js, manifest.json and styles.css from the latest release into <your vault>/.obsidian/plugins/note-relatives/, then enable Note Relatives. It needs Obsidian 1.13 or later. It uses no desktop-only API, so it is not limited to desktop, though it has been tested on Windows only.

Development

npm install
npm test          # the model, the locator, the renderer, and the plugin end to end in Node
npm run lint      # ESLint with Obsidian's review rules
npm run build     # type check, then main.js
npm run dev       # rebuild on every change
node docs/demo/build.mjs --shots   # docs/relations-*.png, from docs/demo

The first pair of screenshots, docs/screenshot-*.png, is taken in Obsidian on a scratch vault of made-up notes.

A release is a tag: npm version patch (or minor, major) bumps manifest.json and versions.json, and pushing the tag makes the workflow build the plugin and draft a GitHub release with main.js, manifest.json and styles.css.

Licence

MIT.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.