Header counter

Hm, that’s weird. I don’t suppose you could paste the Markdown of that note in a code block here, so I can try reproducing it on my end? You can remove any sensitive information from the note, just so long as the bug still shows up for you. Thanks!

I sent you a DM via this forum.

I think it doesn’t work anymore, I tested it now with version 0.9.20 and it didn’t make any difference.

1 Like

@henrique: it has not worked for a long time now. I asked @DanielFlaum if he would make a plug-in, and he said he is waiting for the API to have stabilized.

1 Like

I created the Header Numbering plugin to solve this problem. Hope it is useful to you all!

See GitHub - onlyafly/header-numbering-obsidian: Automatically number headings in a document in Obsidian

8 Likes

@onlyafly
Wow, thank you so much !! Yes, this IS very useful.
Is there a way to have the numbers adjusted automatically when a heading is added or removed?

You have probably thought this through and the answer is probably ‘no’, otherwise you would have added it already. I am asking just in case ……

BTW, I have assigned a hotkey to it, so that makes the renumbering easier.

2 Likes

That was a great idea. I’ve added the automatic numbering to version 1.3.0 of the plugin.

Thanks for the ideas and keep them coming!

tanks very good

1 Like

Glad it’s useful, @Tonyxz !

1 Like

it would be interesting to be able to customize.

1 - Chapter
1.1 - sbuch
1.1.1 - subsubch

or

A1 - Chapter
A 1.1 - sbuch
A1.1.1 - subsubch

@Tonyxz You can get pretty close to your examples currently. The newest version (1.7.1) allows customizing the separator, and you can choose between number and letter numbering.

2 Likes

@onlyafly : from the previous versions I have my front matter as follows:

---
header-numbering-skip-top-level: false
header-numbering-max-level: 6
header-numbering-style-level-1: 1
header-numbering-style-level-other: 1
header-numbering-auto: true
---

I have 1.7.2 and have set the separator style to . dot.
But the dot does not appear between the number and the header text.
I found out I have to delete the old front matter altogether. This was not clear to me from the explanation that goes with the plug-in.

Also, having set the numbering to automatic I suppose all my notes in the vault will be numbered without my having to use front matter.
This is a great step forward.

If I want to exclude a note or a folder within my vault from numbering, is there a way to do that? If so, how?

Hey @Klaas: Yes, you are right, that it is not clear in the instructions that you would have to replace the old front matter. Sorry about that. Hopefully now that I’ve managed to simplify and standardize the front matter format, there will be no more confusions like that for new users.

Regarding how to exclude a single file from numbering, the vault-wide settings are ignored for the file if the file has front matter with a “number headings” key with some value. So, for example, you could put this on top of the file, and the file will not be automatically numbered:

---
number headings: none
---

There’s currently no way to skip a whole folder, unfortunately.

@onlyafly: thanks for the explanation. Everything is clear.

Many thanks for a very useful plug-in. :grinning:

1 Like

What a plugin. Thank you!

Is there a way to put those yaml settings into the global obsidian.css file?

@sebaseba : if your objective is to avoid having to add the front matter in each note, that is already possible.

You can customize the settings in the plug-in settings, which will affect all your notes.

I see. Thank you!

@sebaseba 1 thing I forgot to mention is links. The plug-in adds the header numbers physically to your note. That means the number becomes part of the header name, and that in turn means any links to a header, or headers, of that note will be broken because those links will only be kept intact if the header name is changed manually.

There is a request to make header link name changes automatic, as happens with file name changes.

3 Likes

Ouh, what a shame. Thank you for telling me.

@sebaseba yes, I am speaking from experience. I installed the plug-in enthusiastically, and opened many a note. Most of my notes are long so I use the outline pane a lot.

I then discovered that a lot of my links got broken. I asked the plug-in dev, Kevin, if it would be possible to have the numbering NOT be part of the note, just like e.g. in Typora. He answered that it was not possible with this plug-in :disappointed_relieved:

So, I have disabled this plug-in while I await Licat’s making the link name change automatic when the header name changes. It is currently on his short term road map, so :crossed_fingers:

3 Likes