Rmd outline panel indentation problem

Hi, I’ve been using R for a while, and just started to use R markdown and notebook in R studio.
Recently I found this feature (maybe a bug ?) and want to know whether this is a special problem existing only on my computer.

Problem:
When using R markdown or notebook, the outline panel's indentation follows some strange rule rather than the number of hashes (#).

Reproducible Example:

  1. Open a new rmd file, remove all chunks and text loaded automatically and type the following text. I found that the right outline panel's indentation doesn't work as expected.
    That is, 【## sub title 1】and 【##sub title 2】are NOT indented.

reproducible code:
# big title 1

## sub title 1

## sub title 2

  1. However, if I add 【# title 2】 below, the indentation of outline works.

reproducible code:
# big title 1

## sub title 1

## sub title 2

# big title 2

  1. One more example:
    If I create smaller header in the beginning, outline indentation seems to follow the format of the first header, 【### small title 1】, so only the 【#### sub title 3】 is indented while 【# big title 1】 is not.

reproducible code:
### small title 1

# big title 1

## sub title 1

### sub title 2

#### sub title 3

# big title 2

Sorry for few example images in this post because I'm restricted by this forum (I just created my account)
Is this a “feature” of Rmd ? This makes it hard to navigate long code via outline panel if one forgets to format first few headers well.
Any solution is welcome, thanks.

System Info
Windows 10
platform:x86_64-w64-mingw32
version.string:R version 4.2.1 (2022-06-23 ucrt)
nickname:Funny-Looking Kid
R studio version: RStudio 2022.02.1+461 "Prairie Trillium" Release

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.