From eeba1f1e57fd1b1eabf122dc3b84eb8065cda32d Mon Sep 17 00:00:00 2001 From: Eduardo Barreto Alexandre Date: Mon, 29 Dec 2025 22:50:09 -0300 Subject: [PATCH] feat: Add support to specify the full url --- lib/plug/redoc_ui.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/plug/redoc_ui.ex b/lib/plug/redoc_ui.ex index b03b4cf..493eacf 100644 --- a/lib/plug/redoc_ui.ex +++ b/lib/plug/redoc_ui.ex @@ -46,7 +46,7 @@ defmodule Redoc.Plug.RedocUI do <%= k %>="<%= v %>" <% end %> > - + """ @@ -99,7 +99,12 @@ defmodule Redoc.Plug.RedocUI do redoc_version = Keyword.get(opts, :redoc_version, "latest") title = Keyword.get(opts, :title, "ReDoc") - [redoc_opts: redoc_opts, redoc_version: redoc_version, title: title] + default_url = + "https://cdn.jsdelivr.net/npm/redoc@#{Plug.HTML.html_escape(redoc_version)}/bundles/redoc.standalone.js" + + redoc_url = Keyword.get(opts, :redoc_url, default_url) + + [redoc_opts: redoc_opts, redoc_url: redoc_url, title: title] end @impl true