diff --git a/lib/ash_hq/docs/extensions/render_markdown/highlighter.ex b/lib/ash_hq/docs/extensions/render_markdown/highlighter.ex index d3b4b9d..6365f46 100644 --- a/lib/ash_hq/docs/extensions/render_markdown/highlighter.ex +++ b/lib/ash_hq/docs/extensions/render_markdown/highlighter.ex @@ -365,10 +365,27 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown.Highlighter do end end - defp library_for(module, libraries) do - Enum.find(libraries, fn library -> - Enum.any?(library.module_prefixes, &String.starts_with?(module, &1 <> ".")) + @doc false + def library_for(module, libraries) do + libraries + |> Enum.map(fn library -> + {library, + Enum.find(library.module_prefixes, fn prefix -> + prefix == module || String.starts_with?(module, prefix <> ".") + end)} end) + |> Enum.filter(fn + {_library, nil} -> + false + + _ -> + true + end) + |> Enum.sort_by(fn {_library, match} -> + -String.length(match) + end) + |> Enum.at(0) + |> elem(0) end defp render_code(lang, lexer, lexer_opts, code) do diff --git a/mix.lock b/mix.lock index f924f9f..79a46e4 100644 --- a/mix.lock +++ b/mix.lock @@ -3,7 +3,7 @@ "absinthe_plug": {:hex, :absinthe_plug, "1.5.8", "38d230641ba9dca8f72f1fed2dfc8abd53b3907d1996363da32434ab6ee5d6ab", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bbb04176647b735828861e7b2705465e53e2cf54ccf5a73ddd1ebd855f996e5a"}, "ash": {:git, "https://github.com/ash-project/ash.git", "22e07c06b5e0da531e7e6f632009290031429875", []}, "ash_admin": {:git, "https://github.com/ash-project/ash_admin.git", "cdb3b469abeeadddda884e7cfcf67c6fea10f9ef", []}, - "ash_authentication": {:git, "https://github.com/team-alembic/ash_authentication.git", "d4f3bec947b3cef160fa8e6768396884a3ee6149", []}, + "ash_authentication": {:git, "https://github.com/team-alembic/ash_authentication.git", "00f082cc8dfa0f56d3e2dec3eaf178a58d6d4b4a", []}, "ash_authentication_phoenix": {:git, "https://github.com/team-alembic/ash_authentication_phoenix.git", "14c38739cf56c4821797963b9ee261597a261b00", []}, "ash_blog": {:git, "https://github.com/ash-project/ash_blog.git", "9254773dfedabfc7987af6326a62885c24c3655b", []}, "ash_csv": {:git, "https://github.com/ash-project/ash_csv.git", "2a068cea47d13065f23a3686f4c28bf875353ffd", []}, diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index 2f86744..64e51a6 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -87,7 +87,7 @@ AshHq.Docs.Library.create!( %{ name: "ash_authentication_phoenix", display_name: "AshAuthenticationPhoenix", - module_prefixes: ["AshAuthenticationPhoenix"], + module_prefixes: ["AshAuthentication.Phoenix"], order: 56, repo_org: "team-alembic", description: """