Share text from Markdown Previewer

How can I share my text that I write in the markdown previewer or the resulting HTML? The only thing I can think to do is use an <a> tag to share, but how do I include the text the user inputs in the body?
<a class="share-btn share-btn-email" href="mailto:?subject=Share Markdown&body=" title="Share text via Email">

You won’t be able to share formatted HTML in this way, only textual content. If textual content only is ok for you, then it’s possible with MutationObserver to update href attribute of the anchor tag every time markdown subtree has been changed.