-
Notifications
You must be signed in to change notification settings - Fork 50
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
Link to static asset is broken for code blocks in the root_doc
#121
Comments
ah yeah - this definitely needs a better story around linking the proper libraries...TBH I had no idea what I was doing when I first set up this extension |
We recently switched to use this extension in the Python devguide: https://devguide.python.org/, which is very cool: thanks for writing the extension! Unfortunately, we are hitting this error on the front page. Is there any way we could help to solve this issue? Mybe is possible to fetch the current path when the js is executing:
|
I think we might be able to fix this by using |
Actually, I think it's more complicated than that. I've tried to fix it in #129 but hit a bunch of snags. Specifically:
I think that's the reason we are using the URL_ROOT pattern described here. So perhaps the easiest thing to do is simply to do a JS string replacement to remove the leading Also just a note - I don't think this is always a problem with RTD. Most of the Executable Books documentation is hosted on RTD and the copy buttons work fine (e.g.: https://sphinx-book-theme.readthedocs.io/en/latest/) |
Can't we just have an if statement, for determining the prefix? We don't really need to do any fancy pathto stuff -- the existing logic works everywhere except on the root document, which we can special case?
Am I missing something? |
Nope i think you're just being more pragmatic than i am 😅 |
@choldgraf would you be ok with @pradyunsg workaround? |
oh totally, sorry that wasn't clear in my post above haha 👍 |
When building on Read the Docs, the parameter DOCUMENTATION_OPTIONS.URL_ROOT can return '#' and that returns an incorrect path to the svg icon for the copy button. Closes: executablebooks#121
When building on Read the Docs, the parameter DOCUMENTATION_OPTIONS.URL_ROOT can return '#' and that returns an incorrect path to the svg icon for the copy button. Closes: executablebooks#121
Describe the bug
sphinx-copybutton/sphinx_copybutton/_static/copybutton.js_t
Line 85 in d13f7d1
The code uses
${DOCUMENTATION_OPTIONS.URL_ROOT}
to locate the static file. However, that is#
for theroot_doc
when building on RTD (likely withdirhtml
). This means that the link for the static asset is changed to#_static/copy-button.svg
, which doesn't work.To Reproduce
Steps to reproduce the behavior:
See https://cpython-devguide--679.org.readthedocs.build/ for example.
Expected behavior
The link to the image should be
_static/copy-button.svg
.Environment
See https://readthedocs.org/projects/cpython-devguide/builds/13630239/, which is about as much as I know. :)
Additional context
Cross-referencing with python/devguide#679, because... why not. :)
The text was updated successfully, but these errors were encountered: