Custom ref shortcode for different outputFormat

I have a bit of a trouble redefining my own ref shortcode for custom output format (.md).

I checked the original which only contains:

{{ ref . .Params }}

When I define ref.md this works, as in it definitely is rendered using it, I get static text for instance when testing.

Apparently the .Params is what is passed into it, but it just contains the bare filename (I do not use paths).

I am at a loss how to get the link not pointing to the same output format (now getting rendered as .md), but instead .html - I want the reference from the Markdown output still point to the website.

Since it is a shorcode, nothing like {{ with .OutputFormats.Get "html" }} is going to work.

When I examine what’s in the ., there’s nothing indicating the format that I could change. Only thing I can see is *maps.Scratch, but I am not sure this will be of any help.

Is this beyond what I can do once in a shortcode?

EDIT:

The closest I got was to:

{{ $p := index .Params 0 }}
{{ ref . (dict "path" $p "outputFormat" "html" }}

It fails with REF_NOT_FOUND, but clearly for that output format only, it works with "md".

EDIT2:

Mea culpa, I was building this with separate environment, now that I added html into outputs.yaml it works! I just do not feel all too great about stripping it with index .Params 0.

Also, I really do not need those HTMLs to be generated for that run, but I guess I have to if I want to refer to them.