onlyafly / number-headings-obsidian

Automatically number headings in a document in Obsidian
MIT License
104 stars 11 forks source link

Allow Numbering Prefix #42

Open yorrd opened 1 year ago

yorrd commented 1 year ago

My use case are legal documents.

For example:

# § 1 Heading
## § 1.1 ...

So basically I want to prepend a § to all headings.

onlyafly commented 1 year ago

Interesting idea... I'll look into it!

ironhak commented 7 months ago

Yes please!

michaelsx commented 6 months ago

I have quite a similar issue, I want to prepend a value to the headings with a dot, as I separate my complete document in different sub-documents with the title of the sub-document defining a chapter later on.

So it would be

---
number-headings: auto, start-at 2, max 3, prependValue 5
---

# 5.2 Heading 1
## 5.2.1 Subheading 

I tried to solve it here for me, but could not find the update line to avoid an update loop once a Symbol such as § triggers a whitespace in my example. @onlyafly : Could you tell me where to find the updating? Then I would try to change it and make a pull request if it helps.

https://github.com/onlyafly/number-headings-obsidian/compare/master...michaelsx:number-headings-obsidian:issue-42

michaelsx commented 6 months ago

Missed to update the regex, should be solved now here, at least what I understood as desired result and what I wanted myself as result: https://github.com/onlyafly/number-headings-obsidian/commit/dab634812c550dfeb89c737cef383240b3663916

For testing you can use the BRAT-Plug in a new vaults

[!warning] Do not test in productive vaults as errors can occur!

here some inputs:

---
number headings: auto, start-at 2, max 3, prependValue 5
------
# Heading 1
# Heading 2

Screenshot_Testfile1_prepend

---
number headings: auto,  max 3,  prependValue §
---
# Heading 1
# Heading 2
## Subheading

Screenshot_Testfile2_prepend