I use rehype-autolink-headings in conjunction with the native rehypeHeadingIds() from @astrojs/markdown-remark to generate a link inside the heading. The setup is described in https://docs.astro.build/en/guides/markdown-content/#heading-ids-and-plugins and produces the following HTML:
<h2 id="heading-1"><a href="#heading-1">#</a>Heading 1</h2>
The link should stay inside the <h2> because the font-size of the "#" has to be the same as the heading.
Now when extracting the headings via const { Content, headings } = await render(post);, the headings text value is "#Heading 1" but I want it to be "Heading 1". Now obviuosly I could go about and parse the headings and remove the "#" by myself, but I was curious if there is a built in solution to also override the getHeadings() function.