Action on only selected text?

I am trying to find an action to copy the selected text as RichText. I slightly looked into the Drafts Script Reference but it’s way over my head.

I also found this Copy as Rich Text action, but it will copy the entire draft instead of a selected section of the document.

Background: I am drafting some text in drafts and will need to insert it into Google Doc afterwards as rich text.

See TAD-Copy as Rich Text in ThoughtAsylum - Export/Import/Share action group.

Converts Markdown to rich text and places it on the clipboard. If no text is selected, the content of the entire draft will be converted and copied. If a text selection is made, then only that selected text will be converted and copied to the clipboard. The styling is based on the definition of the STYLE template tag.