Skip to content

Repository files navigation

Property Template Classes

Define note classes as templates and automatically keep instance note properties in sync.

What this plugin does

  • Lets you create property templates as classes and automatically sync them to all instances.
  • Saves manual work when adding a new property to many files.
  • Supports recursive inheritance through class hierarchies.
  • Supports property rename propagation to instances.

How it works

  1. Create class template notes in your configured class folder.
  2. Add frontmatter properties to those class notes.
  3. In any instance note, add a class tag in tags, for example:
---
tags:
    - class/rectangle
---
  1. The instance note inherits class properties.

Inheritance behavior

  • Recursive inheritance is supported.
  • If C implements B and B implements A, then instances of C get properties in order: A, B, C.
  • Duplicate property names are deduplicated by normalized name.

Settings

Class template folder location

Folder containing class template notes.

Allow additional properties in instances

When enabled, instance files keep properties that are not defined by their classes.

When disabled, those extra properties are removed during refresh.

Per-instance override:

  • Add this tag to an instance note to always keep additional properties:
    • allow-additional-properties-outside-classes

Safety notes

  • The plugin warns about class loops and removes loop-causing class tags.
  • If you turn off additional instance properties, refreshing can remove non-class properties from instances.
  • A warning box is shown in settings when this change may affect existing data.

Known issues

  • If you rename a class file after it is already used, class links can break.
  • For now, avoid renaming class files once they are in use.
  • Renaming properties inside a class works as expected.

Commands in settings

  • Manual refresh: refreshes class relationships and instance synchronization.
  • Insert example: creates a sample class hierarchy and usage note.

Development

Requirements:

  • Node.js 18+ recommended
  • npm

Install:

npm install

Build:

npm run build

Watch mode:

npm run dev

Lint:

npm run lint

Manual install (for testing)

Copy these files to:

<Vault>/.obsidian/plugins/property-template-classes/

  • main.js
  • manifest.json
  • styles.css

Then reload Obsidian and enable the plugin in:

Settings -> Community plugins

About

An Obsidian plugin that lets you define note classes as templates and automatically keeps properties of instance notes in sync.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages