Check that a note conforms to a specific template

Templates are very useful to impose a specific structure to a note at creation time. But, it’s very likely you’ll modify the template over time (the headers, the metadata, …), and the notes you would have created prior to that modification won’t fit the template anymore.

I think it would be very useful to have a plugin that can tell you if a note is consistent with a specific template, and if it isn’t highlight the differences (missing header, etc.).

That would open up a whole new level of quality checks on your vault, making it more consistent. For example, this could enable you to ensure all your book notes have the same structure, etc.

Anybody else thinks this could be useful ? Is there already a plugin that could be used for that ?


YES! I have daily notes imported from other systems that are named correctly or in a designated folder but do not have the proper yaml or top structure.

A second issue are those gaps in prev and next navigation that are not yet created but when you click them it does create a new note, but not with the right templated stuff.

From my vantive, not only a check but an option to fix.


Agree !

Fixing might not be trivial depending on what’s missing, that’s why I’m aiming for checks first.

Not sure if it’s something easy to do on obsidian, however you can use other tools for that.

If you are running Windows, you have a application called diffmerge that highlights the diferences like GitHub does when you commit a change to a file. As far as i know the application is free and offline.

EDIT: The application will show everything that is different, but at least is faster to spot the diferences.

1 Like

Thanks for your input Zektor.

Indeed as you suggest, an external tool could be used. I’m thinking of developing this feature as a python library.

The issue with tools like diffmerge is that, as you said it’ll point out all the differences between the note and its template, I just want the structural differences (name and order of the headers etc.)

Not sure how I could tweak existing tools like diffmerge to achieve this result. But a couple of regular expressions in javascript / python should do it quite easily.

Would you be interested in such a feature for maintaining your own PKB ?

You can probably make that with JavaScript, not sure how since it’s not my area of expertise.

I would be interesting to test a plugin like that but it’s not applicable for my use case.

I do this via YAML. One of the Fields I have is TEMPVersion -Then the name.

So for example I have a book template. In the fields I have TempVersion: Book Layout Version 1

I then have a page setup which shows me all the pages which Have Book Layout Version 1 .

If I then update my Template, I simply change the version number to 2, update the query to look for all pages on Version 2, and then all pages not on version 2.

Each Template has its own unique name, BookTemplate, PersonTemplate etc etc.

Works well.


Great idea @bsycamore thanks for sharing.

With this setup, one problem that could arise is that the note says TEMPVersion : BookTemplate-v1, but it doesn’t actually respect the template (because you’ve accidently deleted a header, or some other unwanted modification).

The plugin I’m suggesting would address this problem. It would also remove the need to version your templates (BookTemplate-v1, BookTemplate-v2, etc.) as you could modify BookTemplate and directly “highlight” the notes that don’t respect the template anymore.

I think such rigid verifications aren’t needed for most use cases and what you suggest already does a great job at enforcing some level of structure.

I have mix feeling abou your comment @bsycamore … Not sure if I should say “thanks for the awesome idea” or "go to hell … I have to rework a lot of notes because of you "

Either way that is a grate way to do it, you are awesome!

@ Zektor Either comment is fine :slight_smile:

In my day job, having version control of Documentation & Systems / software is a must.

In my hobby, which is RPG’s, having a system that works for me and my ever changing documents is probably more a must than having at work.

I started with a Monster Template, added it, set some monsters up, went back and tweaked and tweaked and tweaked. The template is now at Version 16, and the 200 or so Monsters vary between Version 10 and 16.

1 Like

@bsycamore do you think there could be a way to automatically “upgrade” monsters with version (10-11) to version 16 ?

I see 2 possibilities:

  • automatically “re-ordering” the note (if the difference between the versions is just the order in which you display your headers, for example)
  • highlighting for each monster in which ways it doesn’t fit to version 16 (basically a “git diff” that only takes into account structure (headers, for example) and metadata). Hence speeding up significantly your efforts if you decide to upgrade them manually one day

@srbd If there was a way, I would be using it, or at least trying to.

Having some way of having two documents open, then running a compare or similar process would make life easier, especially when you are comparing a document that’s on Version 10 to a template that’s on say V 16.

One other thing I also do, is a have a Version History at the bottom of each Template that clearly shows each change to each Version.

1 Like

Here’s the workflow I’m trying to setup that motivated my need for such a feature.

I’m doing research on companies in a particular field, and would like to create a technical note for each of them, something like:

year created:

# <company-name>

## business model

## SWOT analysis
### strengths

### weaknesses

As I am doing my research, the information I seek for each company keeps evolving. I might drop the SWOT section, add new sections and metadata such that might template now looks like:

year created:
IPO: true
markets: <country1>, <country2> 

# <company-name>

## business model

## community

## pricing

The point is that this template evolves very often, as I figure out what I’m aiming for exactly. A tool that could highlight structural differences with this rapidly evolving template could basically act as my todo-list (ex: missing header “## business model” for company X,Y and Z → I’ll research that later.

If anybody has had similar workflows or needs, I’m interested in hearing about it !

1 Like

It’s as bsycamore example.

You can add a version to every file and do a DataView request that filters by the version.

Once you have that information you can place an order by to view the oldest vestions at the top

1 Like

Yes, I use diff merge apps to spot differences, but in my case, I want to have a standard yaml front matter at the top for each note in a particular folder (dailynotes).

The code would iterate thru the entire folder contents, identify those notes with no yaml header, and for each headless note apply a yaml frontmatter template.

This activity is common to all folks I know that are migrating notes from other sources into Obsidian. I am able to do this using the jinja templates in Readwise, but many folks are not script savvy.

The coolest diy interface I’ve seen for import notes from other sources, in this case a csv file exported from OneNote, was created by an accounting friend who used an Excel macro with a for loop iterating thru the source and print commands for each line in the yaml.

Clever folks in this space!

It sounds like one approach here could be:

  1. Create/find something analogous to JSON Schema that specifies the expected structure of headers in a markdown file.
  2. Add a field to yaml frontmatter that specifies the expected schema, e.g. daily-note-1.7.2.yml
  3. Use a “linting” tool such as markdownlint to validate notes against their specified schemas.
  4. Optionally extend to use semantic versioning in order to differentiate between minor changes (e.g. adding a Habits h3 section to your daily note) and major changes (e.g. splitting the contents of your daily note into Work / Personal h2 sections.
1 Like

Sounds promising, thanks @asdfgeoff . I didn’t know about markdownlint, will check it out.

Does this functionality sound like something you would use in your workflow ?

My plan is the build this functionality in a python package, as that is what I’m familiar right now. If it turns out useful to others, it could be transformed into a JS plugin