API client design: generating template code for client

Hello I am forking a project’s recaptcha code. But want to make this a little bit more readable for my local project. Here is the code. It returns a string with reCAPTCHA code, which means that the consumer will have to convert the string to HTML code using Phoenix.HTML.Raw/1, is there another way to do this? A better way perhaps, without the use of raw?

defmodule Recaptcha.Template do
  require Elixir.EEx
  alias Recaptcha.Config

  EEx.function_from_file(:defp, :render_template, "lib/template.html.eex", [
    :assigns
  ])

  def display(options \\ []) do
    public_key =
      options[:public_key] || Config.get_env(:recaptcha, :public_key)

    callback =
      if options[:size] == "invisible" && is_nil(options[:callback]) do
        "recaptchaCallback"
      else
        options[:callback]
      end

    onload =
      if options[:onload] do
        "onload=#{options[:onload]}&"
      else
        ""
      end

    options_dict = Keyword.put(options, :onload, onload)

    render_template(%{
      public_key: public_key,
      callback: callback,
      options: options_dict
    })
  end
end

The template.html.eex that it references is just standard html code with variables interpolated.

Thank you for your help.

You could wrap your recaptcha in a struct and have it implement Phoenix.HTML.Safe protocol