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.19k stars 80 forks source link

Bug: Heading blank lines not only adds a blank line before/after headings, it also removes consecutive blank lines #1146

Closed bluebirch closed 1 month ago

bluebirch commented 1 month ago

Describe the Bug

Heading blank lines not only adds a blank line before/after headings, it also removes consecutive blank lines, effectively ensuring there is one and only one blank line before and after headings.

How to Reproduce

Before:

text

# heading 1

text

## heading 2

text

After linting:

text

# heading 1

text

## heading 2

text

Expected Behavior

Expected output is same as input.

Screenshots

image

image

If applicable, add screenshots to help explain your problem.

Device

pjkaufman commented 1 month ago

@bluebirch , I believe this is the intended behavior. Please see the examples under https://platers.github.io/obsidian-linter/settings/spacing-rules/#heading-blank-lines. Please let me know if this needs more explaining. Thanks!

bluebirch commented 1 month ago

There is no example there showcasing consecutive blank lines. And the description only mentions inserting blank lines. And that "all headings have a blank line both before and after", which perhaps chould be clarified as "all headings have exactly one blank line both before and after" (or, as I expected, "all headings have at least one blank line both before and after". "A blank line" can mean both.

pjkaufman commented 1 month ago

The example here does show consecutive blank lines getting cut down to exactly one: image Or am I seeing thing?

And that "all headings have a blank line both before and after", which perhaps chould be clarified as "all headings have exactly one blank line both before and after" (or, as I expected, "all headings have at least one blank line both before and after". "A blank line" can mean both.

Clarification could be added to say exactly 1 blank line, though I am not sure that saying "A blank line" should be considered to allow both one and many blank lines in the source file. But adding extra clarification to the wording here to make this clearer would be a win.

I can see about updating the wording to say that it will only have 1 blank line.

bluebirch commented 1 month ago

The example here does show consecutive blank lines getting cut down to exactly one:

You're right. Sorry. Missed that. Yes, please clarify, if nothing else to avoid bug reports from people like me. 😉

pjkaufman commented 1 month ago

Sounds good. I will do that and then close this issue out when I make that doc change.

pjkaufman commented 1 month ago

The wording update should be ready to go live in the next release and on master.