Suggestion: Method for automatically changing headers in selected text

I searched here for any plugins that could do this automatically, but I didn't find anything. For now, I'm using a Bash script to do this.

Suppose I have the following note in .md format:

# A                <!-- Line 1 -->
# B                <!-- Line 2 -->
## C               <!-- Line 3 -->
### D              <!-- Line 4 -->
#### E             <!-- Line 5 -->
# F                <!-- Line 6 -->

I want to be able to select lines 2 to 5 and be able to increase their header levels in bulk, so that all of them become nested in header #A:

# A
## B
### C
#### D
##### E
# F

I would also like to have an option to reduce the header levels of the selected lines, which would result in:

# A
# B
# C
## D
### E
# F

This would be very useful when merging notes, as the old header levels recurrently impact readability on the TOC in the Outline plugin.

You can also open the note in an external editor, and from there there may be plugins to do that kind operations (for example with VSCode). Personally I just use a regex from VSCode when I need to do this kind of change, but it's true that a plugin would be convenient

1 Like

I honestly hadn't thought about external editors and Find and Replace Regex plugins. Thank you.