Indent text same amount as its heading (for a plugin)

Current Situation

I am working on a plugin that turns headings into an “auto-formatted” alphanumeric outline. It’s a use case I use often, but because it wasn’t in obsidian it kept me from doing this work in it.

I am using ClaudeAI to help me code this, since I am not a programmer. (If it’s cheating, so be it… :man_shrugging: :rofl:) And my project felt easy enough for this approach.

It takes this:

# Introduction
## First Point
## Second Point
### Detail
### Detail
# Main Section
## First Point
## Second Point
### Detail
### Detail

And produces this:

What I need help with

Is there a way to identify the text that is immediately subordinate to a heading and target it with the same indentation spacing? I don’t know what that would be called.

I wanted to use headings so that I could still type text, use callouts, and even place images. But, all of that stays aligned to the left. While the CSS targets the headers and indents them nicely.


Here’s the repo link if anyone is interested at looking at that.


If this is not the correct forum for this question/topic please let me know.

Moved from Plugins ideas (requests for plugins people wish existed) to Custom CSS & Theme Design (altho Developers: Plugin & API is generally the place for help with plugin development; if the questions involves more than CSS we can move it). Changed title to describe the help needed (was “Alphanumeric Outliner - In Development”). Good luck!

Thank you… still learning how to navigate the forum.