This is a great description. I think I mentioned in Discord that it isn’t just that the headings are all siblings without hierarchy, it is that they are all children of identical siblings without hierarchy.

I am sure there is a good reason for this, and like you say, nothing that a plug-in could not attempt to fix.

1 Like

Hi Daniel, Thank you!!! I can’t believe my eyes that you write down such a great and clear tutorial for me (and for organizing your thoughts). It must take your time to do this. Thanks again! It’s so amazing and you are really good at explaining! It helps a lot. I will read it again to make sure I learn more from your work.

1 Like

Hi Daniel, what a fantastic explanation, clear and in simple, layman’s terms. Very impressive. As a layman I do not fully understand it all, but the picture IS getting a bit clearer, esp. because of the images you provide with it.

I am going to bookmark this page and will come back to it many time.
Thanks again for all your help and patience. Who knows, if the Obsidian API becomes reality perhaps you can write that plug-in.

@klaas, I was wondering how the outline was treating you. Thought you’d be happy. :slight_smile: Smart people on this thread.

I presume you mean the header counter in the outline pane: correct?
If so I can state unequivocally that @DanielFlaum’s code is perfect, and, having tried it on 3 or 4 themes, his statement that it will work on all themes has a probability of truth that borders on certainty :wink:

Seriously, his code works well, and as expected. When API becomes reality I hope he will write the plug-in for both outline and note content.

Daniel, I am sorry to bug you again. I just noticed an oddity - see screenshot.
Heading 5.9.5 is correct: it relates to an H3 header.

But both headers 5.9.5.001 are wrong because there is an H4 header (####) in each place.

odd-number

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

7 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.

1 Like

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