guopenghui / obsidian-quiet-outline

Improving experience of outline in Obsidian
MIT License
287 stars 17 forks source link

Heading levels display is wrong #149

Open huachuman opened 7 months ago

huachuman commented 7 months ago

I have H1 through to H6 in a document. The following screenshot is QuietOutline set to H1. But it is also displaying H2 as well as H3 and H4. Not only that, but they are all displayed as being the same heading level in QuietOutline.

image

The "High level overview..." heading is an H4, the "Notable Excerpts" is an H3, the "Skipped" one is an H3, and the "A starter bibliography" is an H2.

Pressing reset or dragging the scroller back and forth changes the display level but does not fix it. Like, some H3s are only showing up if I drag it to H4, for example.

Totally out of control. What's going on?

guopenghui commented 7 months ago

The current pattern of quiet outline is that if a heading has no parent, it is considered a top-level heading, i.e. H1

This is because the underlying represent structure of heading is a tree. An H1 is a root, and a node can't live without a root.

Mostly this mechanism works fine,but sometimes users have different needs too.

huachuman commented 7 months ago

But they all live in the parent H1 at the top of the document...

guopenghui commented 7 months ago

But they all live in the parent H1 at the top of the document...

Oh, then they may be both H2. You can only have a child when its parent exits.

huachuman commented 7 months ago

Mostly this mechanism works fine,but sometimes users have different needs too.

I would argue this mechanism is not fine, and my needs are not "different," they are actually expected behavior for how all outlines should work.

The current behavior is very strange indeed.

guopenghui commented 7 months ago

H1 -> H2 -> H3 ...

huachuman commented 7 months ago

H1 -> H2 -> H3 ...

?

guopenghui commented 7 months ago

Current implementation is using a UI library, it requires a tree-like data and treats the root as H1. There is no method to directly have an H{2,3,4,5,6}. Maybe futrue update of this library will have this option.

guopenghui commented 7 months ago

I totally understand it's better to make headings as they are in notes though.