How to reuse Hugo's default passthrough processing logic

I create render-passthrough.html like this:

{{- if site.params.math.type "katex" -}}
  {{/*  for KaTeX server-side rendering  */}}
  {{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block") }}
  {{- with try (transform.ToMath .Inner $opts) }}
    {{- with .Err }}
      {{- warnf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s: see %s." . $.Position }}
      {{- if eq $.Type "block" -}}
        <p><mark class="text-danger">KaTeX parse error!</mark></p>
      {{- else -}}
        <mark class="text-danger">KaTeX parse error!</mark>
      {{- end -}}
    {{- else }}
      {{- .Value }}
      {{- $.Page.Store.Set "hasMath" true -}}
    {{- end }}
  {{- end -}}
{{- else -}}
 {{/*  TODO keep original output of Hugo rendering, maybe a .Delimiters is needed? (like: .Delimiters  => ['$$', '$$'])  */}}
 {{/*  $delimiters := .Delimiters  */}}
{{- end -}}

for example, if the markdown input is: $$c = \pm\sqrt{a^2 + b^2}$$ and no render-passthrough.html file is found, the output will be: $$c = \pm\sqrt{a^2 + b^2}$$.

however, if I defined render-passthrough.html, I can’t get the delimiters.

If I could obtain delimiters in render-passthrough.html, I could do more than just render Katex math.

as of now there is no way to get the delimiters.

you could: set the delimiter to fe @@ and write something like.

@@$$ ... $$@@ then you have the Inner wrapped in $$. remove it with a regex and render.

and you may then check for other delimiters