Inconsistent Rich Text in Notes

Hi there! I am working on this shortcut for taking a quick note while listening to a podcast in Overcast. If run with no input, it will get the podcast, episode title, timestamp, and if available, the chapter title and chapter title URL. If it’s run from the share sheet (e.g. while viewing a webpage from the show notes), it also grabs the title of the webpage and URL. I’m using markdown to format everything, and if a note already exists for the podcast, it opens that note, allowing you to paste the rich text. If no note exists for the current podcast, it creates one and opens it.

What I cannot seem to figure out is this: the copy-and-pasted text isn’t always formatted the same, even though the markdown is identical. Namely the title of the episode, which should be formatted as a heading (##), is sometimes formatted properly, but other times is simply bold body text. I cannot seem to find a pattern for this behavior — I thought it was based on whether the Shortcut was run with or without input, but testing shows that’s not always the case. Has anyone else run into this?