It sounds like you are talking about a DataURI.
Here’s how you could do the conversion in Scriptable for an HTML string (read in from a file or wherever), with a caveat.
let strDataURI = "data:text/html," + encodeURIComponent("<html><body><h1>Foo</h1><p>quz <strong>qux</strong</p></body></html>");
Line 1 generated the URI. Line 3 tries to open it, but nothing happens in Scriptable. Not even a console message. I’m not sure it supports such URIs.
Line 2 copies the URI to the clipboard, so if you paste it into Safari’s address bar, you can see it working.
If you comment line 3 and uncomment line 4, you can see what the
Safari.open() normally does.
As a workaround, I would suggest opening a Shortcuts shortcut that takes the DataURI as a parameter and opens it. Comment out line 4 and uncomment line 5. Install the two step shortcut below (being explicit with the URL seems to work better than coercing the input via magic variables in my testing, otherwise it would have been one step).
Hope that’s what you’re looking for, but if not, perhaps you could provide more details, and perhaps a copy of the shortcut you have used previously along with what you want to vary in Scriptable.