You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: always indent based on heading level rather than parent sections
## Details
This is a follow up to: #164
Following this PR several edge cases were fixed around intation when
used with heading borders. Along with edge cases when not starting with
an H1 in the document.
However there was still a problem when indentation level was reduced
which caused additional space to be added to the top border.
Rather than patching this I went the direction of unifying the
definition of a heading level. With this content underneath a heading is
always indented to that level, i.e. an H3 will always have 6 starting
spaces. Before this would only happen if an H1 & an H2 were included
before, this is no longer the case. To do this logic to calculate the
change in level between sections was added. Also H1s become less of a
special case, we simply define the default document level as 1 so H1s
end up at the same level leading to no change.
This on its own would cause problems with upper borders since they would
be indented based on the previous section. To fix this the range that a
section covers was changed from what treesitter provides. Empty lines
above a section belong to the lower section making the indentation more
or less just work.
0 commit comments