Generate outline automatically from indentation

Hi, community. Recently I have this idea of generating outline automatically from indented writing texts. see below:

Idealy, if this is a plugin, one could use it to navigate through long complex writing without bothering manually setting the structure ahead.
And to make it even better, it should scroll with the page.
Is this possible ?