Allow listing outside URLs in extras#2103
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
| if custom_search_data = map[:search_data] do | ||
| extra_search_data(map, custom_search_data) | ||
| else |
There was a problem hiding this comment.
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! |
| const items = [] | ||
| const hasHeaders = Array.isArray(node.headers) | ||
| const translate = hasHeaders ? undefined : 'no' | ||
| const href = node?.url || `${node.id}.html` |
There was a problem hiding this comment.
Should we add an icon, such as this one, for URLs?
If so, you can upload this bundle to remixicon.com, add external link, and get the new font back: https://github.com/elixir-lang/ex_doc/blob/main/assets/fonts/RemixIconCollection.remixicon
|
@josevalim Suggestions and changes made, ready for another pass |
josevalim
left a comment
There was a problem hiding this comment.
Sorry for the delay. I have only two tiny comments remaining and we can ship it!
|
@josevalim Updated! |
|
Closing and reopening to kick CI back to life. |
|
📦 Docs artifacts are ready: https://github.com/elixir-lang/ex_doc/actions/runs/14684053427/artifacts/3015141536 |
|
💚 💙 💜 💛 ❤️ |
|
Hey @josevalim there was hard breaking change introduced here. That looks quite intentional. However, ex_doc does usually give a heads up in the form of a soft deprecation, although ex_doc is not obliged to per it still being 0.x. I would just like confirmation on this so I can make an informed decision about what to do in rebar3_ex_doc 😄 |
|
What was the breaking change? I would be glad to revert it to something less breaking. |
I missed some context. Sorry, this was not a breaking change in ex_doc, rebar ex_doc plugin is at fault here. TL;DR we allow pasing in a map, and it used to be it just happened to work because there was no explicit usage of There's changes to make over there, not here 😄 Sorry for the noise. |
|
No worries at all, if there is something we can do on our side, please let us know! |
Short of opting to use maps instead of keyword lists, I don't think there is much to do on this side 😄 |
|
I believe we can accept both keyword lists and atoms and normalize them accordingly. My goal in the short term future is to convert them to structs instead of passing around raw maps. |

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 theurlvalue is an actual URIExpand formatter testsurloptionsCloses #2084