-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow listing outside URLs in extras #2103
base: main
Are you sure you want to change the base?
Conversation
This makes it possible to delcare URLs as extras and have them listed as links in the sidebar. For example, to set a "Wikipedia" url: ```elixir extras: [ "Wikipedia": [url: "https://wikipedia.com"] ] ``` Closes elixir-lang#2084
68d3c53
to
639afcc
Compare
defp normalize_extras(base) when is_binary(base), do: {base, %{}} | ||
defp normalize_extras({base, opts}), do: {base, Map.new(opts)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purely for pattern matching to flatten out build_extra/5
. The alternative was a cond in build_extra/5
, but this seemed a little clearer.
if custom_search_data = map[:search_data] do | ||
extra_search_data(map, custom_search_data) | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a clause for this rather than a conditional in the function body.
For the |
Suggestions applied, changes made , and residual TODO items addressed. This is all set! |
This makes it possible to delcare URLs as extras and have them listed as links in the sidebar. For example, to set a "Wikipedia" url:
This is currently light on some validations. I'll expand the tests and URI validation if the approach is improved.
Validate theurl
value is an actual URIExpand formatter testsurl
optionsCloses #2084