How to Convert Markdown (.MD) Files to HTML in Power Automate

Cloudmersive
5 min readDec 18, 2024

--

Markdown is a pared-down web markup language designed to make structuring web content more straightforward and accessible. After content is created in Markdown, it can then be converted to HTML and interpreted in a web browser.

There are several different ways Markdown to HTML conversions can take place. For example, many popular blog sites (such as Reddit) tend to accept Markdown in their regular text editor fields, allowing users to apply an element of customization to their text before automatically interpreting the Markdown as HTML for display to other users on a blog page.

There’s also the option to convert Markdown files — .md — to HTML files directly. This makes sense when we’re working on generating static website content offline, as opposed to entering Markdown content directly into a website text editor.

Convert Markdown to HTML in Power Automate

When we use create static .md files, we’ll need a method for converting them to HTML in batches — and Power Automate is a great tool for solving that type of problem.

In this article, we’ll demonstrate an easy-to-use .md to HTML conversion solution in Power Automate. We’ll take advantage of the Cloudmersive Document Conversion connector to convert a folder containing several static .md files to HTML.

We’ll build a manually triggered instant cloud flow in this case so we can have full control over our data.

In the first step of our flow, we’ll get information about the Markdown files we plan to convert to HTML. In my example, I’m grabbing files from a OneDrive folder, so I’m using the List files in folder action.

The List files in folder action retrieves the unique identifier for each file in any folder, along with the file name and other information.

In our next step, we’ll add a Get file content action that uses the Id (unique identifier) value to retrieve a set of file bytes for each file in our folder.

Since the Id value is an array, Power Automate will automatically wrap this action in a For each control.

Within the For each control, we’ll now add our Cloudmersive Convert Markdown to HTML action.

To find it, we’ll first search for Cloudmersive connectors in the Power Automate connector library. We’ll then locate the Cloudmersive Document Conversion connector with the green logo.

Once we find this connector, we’ll click “See more” to view the full actions list.

From there, we’ll CTRL+F search for an action titled Convert Markdown to HTML.

After we select this action, we’ll need to turn our attention briefly to connector authorization.

Since we’re using a third-party connector, it’s first important to note that we’ll need a premium Power Automate license to access this connector in the first place.

As long as we have access to third-party connectors, we can try Cloudmersive connectors for free with a free-tier API key. Free API keys allow a limit of 800 API calls per month and zero commitments.

When we’ve finished creating and authorizing our connection, we’ll turn our attention to configuring our Markdown to HTML conversion request parameters. We’ll enter our file bytes and file names into each of the two request parameters we see below.

Now that we’ve asked Power Automate to handle our conversion, we’ll simply add a Create file action and write our converted documents to a series of HTML files in our system. We’ll use the body/HTML response content in the File Content parameter.

We can use the Name without extension value to dynamically retain the same names as our original Markdown files. In my example, I’ve added some additional text to each name to further distinguish them from the originals.

After we save and test this flow, we’ll find our new HTML files stored in our target folder.

In my example, I chose to store the new HTML files alongside the original Markdown files.

And just like that, we’ve successfully converted all our Markdown files to HTML with one quick Power Automate flow.

It’s especially easy to make Markdown to HTML conversions in Power Automate given both files utilize plain text content.

Be sure to check out additional Cloudmersive Document Conversion connector actions to see how they might impact your file conversion automation workflows!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet