Fix swup cross build navigation#2246
Conversation
|
📦 Docs artifacts are ready: https://github.com/elixir-lang/ex_doc/actions/runs/27211620233/artifacts/7510038011 |
|
@garazdawi couldn't the check be simpler and instead we only use swup if there is no |
| // like `Foo.html#fun/1`, sidebar entries — on the SWUP path, which a plain | ||
| // `[href$=".html"]` (matching only hrefs that *end* in .html) would drop. | ||
| export const LINK_SELECTOR = | ||
| 'a[href]:not([href^="/"]):not([href^="http"]):is([href$=".html"], [href*=".html#"])' |
There was a problem hiding this comment.
If we only accept things that do not have a / in it:
| 'a[href]:not([href^="/"]):not([href^="http"]):is([href$=".html"], [href*=".html#"])' | |
| 'a[href]:not([href*="/"]):is([href$=".html"], [href*=".html#"])' |
|
Anchors contain |
|
Though having thought a bit more, maybe that is not an issue as swup is not enabled for local anchors anyway, right? |
|
Good call! No SWUP for local anchors but we can refer to anchors across files... and we still want SWUP. So I guess we keep the |
a6e76a7 to
c58be6f
Compare
|
|
||
| window.addEventListener('DOMContentLoaded', emitExdocLoaded) | ||
|
|
||
| export const LINK_SELECTOR = 'a[href]:not([href^="http"]):not([href*="/"]):is([href$=".html"], [href*=".html#"], [href^="#"])' |
There was a problem hiding this comment.
Sorry, I think there was some confusion. I am afraid we cannot do this because then it won't use SWUP when navigating from Float.html to Integer.html#foo/2?
So I think we need to have the code we have before, the difference is that isCrossBuild can be replaced by something like "noUnderscoreBeforeFragment" or similar?
There was a problem hiding this comment.
I noticed as much myself. I'm working on a new fix. I thought I had it working with the pushed solution, but that turned out to be due to a stale build of Erlang/OTP docs...
We force a full reload if there is a anywhere in the path. Fix issue introduced in a66397f where anchors are not swupped.
c58be6f to
6d47096
Compare
|
Should be fixed now. Tested it on a local Erlang/OTP docs build. |
|
💚 💙 💜 💛 ❤️ |
This PR fixes two things with SWUP.