-
Notifications
You must be signed in to change notification settings - Fork 40
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
Embed APIv3: use latest embed API version #146
Conversation
fb63f85
to
e463808
Compare
`data['content']` returned by the API is not a single string (not a list) --so, we need to tell tooltipster to show it as HTML https://www.heteroclito.fr/modules/tooltipster/#options
The content returned changed from being a list of one element to just a string.
63bd0d8
to
c8d8016
Compare
c8d8016
to
171920a
Compare
5a1efe2
to
af03ce8
Compare
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.
Looks like a good approach, and much simpler 👍
Might be worth doing a call with @readthedocs/frontend folks to see if there's anywhere to collaborate with the UX while doing some release testing.
We are not using `data-` attributes anymore. Everything is based on `class=` and `href=` attributes from the elements. `hoverxref_project` and `hoverxref_version` are not required anymore and they are deleted as well.
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 looks like a way nicer way to integrate things. Really glad to see this simplified.
Do we have a release plan for this code documented anywhere? I guess we can install it via git directly to test if we want, but doing some kind of beta release to pypi might be interesting.
hoverxref_api_host = 'https://readthedocs.ngrok.io' | ||
if os.environ.get('NGROK_READTHEDOCS') == 'True': | ||
# Building on a local Read the Docs instance using NGROK for HTTPS | ||
hoverxref_api_host = 'https://readthedocs.ngrok.io' |
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.
Shouldn't this value get pulled from the environment, so other people can use it if needed in dev? eg NGROK_HOVERXREF= https://foo.ngrok.io
.
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.
Haha! Yes! I don't know why I didn't do it like you are suggesting originally 🙃 It should probably just use hoverxref_api_host
all in uppercase.
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.
I suppose that I hardcoded it here so I don't have to remember the different URL options 😄
|
||
Default: It defaults to ``READTHEDOCS_VERSION`` environment variable | ||
Default: ``https://readthedocs.org`` |
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.
How are we planning to support this on .org & .com? Should we do this automagically, or just always default to .org?
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.
Hrm... good question!
I haven't thought about this, honestly. I don't think we have a way to differentiate if we are running in .org or .com from the builder. It may be good to expose an environment variable? In that case, we can use it to differentiate.
Actually... I just remembered that @stsewd already mentioned this in #134 --so, we should probably continue the conversation there, finish that PR, and merge it. I think it was good, but there was an issue with CORS that I don't remember where we ended up.
I was planning to release a Once we have that release being used for months, I thought we could start thinking about having a 1.0 version; which I think we are close to regarding features and bugs. I don't see too many issues or requested features still around. |
This PR makes usage of the Embed APIv3 that's going to be available in Read the Docs soon. It mainly changes how the API URL is generated. Instead of reading arguments (
data-*
) injected at build time by Python, it uses only oneurl=
argument which is retrieved from thea.href
property via Javascript on hover event.Note that this reduces the complexity of the Python code a lot since we don't need to resolve references and hard code them into
data-*
attributes anymore.ToDo
find a way to send the full URL to EmbedAPI (from Python code we can't know the hosted URL)data-
elements?hoverxref_project
and_version
to be requiredRelated readthedocs/readthedocs.org#8521