Need Help with Pandoc Image Inclusion in RTF Output*

Hello community,

I’m currently working on a script that uses Pandoc to convert Markdown to RTF format. However, I’ve encountered an issue where images from the Markdown file are not being included in the RTF output. What I want to try to achieve is converting selected text from markdown to rich styled text formatted text.

Here’s the part of my index.ts script where I perform the conversion:

// ... [previous code]
await execAsync(`${pandocPath} -f markdown-smart -t html -H ${cssHtmlPath} ${tempMarkdownPath} -o ${tempHtmlPath}`);
await execAsync(`textutil -inputencoding utf-8 -format html -convert rtf ${tempHtmlPath} -output ${tempRtfPath}`);
// ... [following code]

And an example of the Markdown with an image:

![Random Image](

Random Image

I understand that textutil might not support embedding images when converting from HTML to RTF. I’m looking for suggestions on alternative tools or methods that could handle this task, ideally without deviating too much from my current workflow.

Has anyone here dealt with a similar issue or have any recommendations on how to include images in the RTF output? Any advice or pointers would be greatly appreciated!
My HTML webpage already includes the image in the webpage!

Thank you in advance for your help!

Here is my full raycast extension.