platers / obsidian-linter

An Obsidian plugin that formats and styles your notes with a focus on configurability and extensibility.
https://platers.github.io/obsidian-linter/
MIT License
1.12k stars 78 forks source link

FR: Add check to avoid recursive rule combinations #856

Open tsievert opened 11 months ago

tsievert commented 11 months ago

Is Your Feature Request Related to a Problem? Please Describe.

Assume you have enabled the following rules:

  1. Lint of file change
  2. Insert file name as H1 if no H1 exists
  3. Start header increment at H2

If you have a note called filename every file change will result in a new H1 which is immediately turned into H2 and pushes all other headings one level down, resulting in:

# Filename
## Filename
### Filename
#### Filename
##### Filename
###### Original H2 

Describe the Solution You'd Like

Show a warning when both Insert file name as H1 if no H1 exists and Start header increment at H2 are enabled, or make those options mutually exclusive.

pjkaufman commented 10 months ago

Hey @tsievert . I like this suggestion, but I am not sure how to best do this since rules do not know about each other. They just know the common settings and their own information.

It is not easy to build these relationships out of which settings are not compatible with others and so enabling one should disable or at least warn you when it is enabled. I am not sure if you have any ideas on how to do this logically?

I was thinking I could show a modal before running the Linter if incompatible/contradictory rules are enabled and list out the rules that are incompatible and that they may cause issues if run together. However it would be better to tackle this at the level of enabling settings.

tsievert commented 9 months ago

Unfortunately I don't have any good idea. A quick and easy solution would be to group the two toggles under a separate header and display a giant warning message that enabling both at the same time WILL cause issues (and maybe link to this issue?).