I'm trying to figure out a way to convert this type of Markdown header:
# Sample Header
to this type:
Sample Header ====
Backstory: My firm's case management app uses underscores instead of asterisks for bold/italics, and also use equal signs (====) under headers, instead of a hashtag before them.
I take notes in Agenda, which has a "Copy to Markdown" feature. I have a KM macro that, when activated with a keystroke, will delete the first line of the current Agenda note (my client name, which I don't need in the client file), copy the note as Markdown, replace all the "*" with "_", and paste into my case management system. (I brute force the pasting step, using a found image to put it at the correct spot).
The final piece of the puzzle is to convert the headers to the correct format. I've looked at and played around with regular expressions, but this is beyond my limited ability. If there's anyone that can help, I'd be really grateful.
Here is what I have so far: