Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit 1bd7fdc

Browse files
committed
Development: tip to hit local instance from online documentation
Small tip to document steps to hit a local development instance from an online documentation site we don't have control. This is useful to test a new change in the backend that's not deployed yet.
1 parent 2b71455 commit 1bd7fdc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/development.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,32 @@ and the tooltips should work without problem.
9494
.. _install Read the Docs locally following these instructions: https://docs.readthedocs.io/en/stable/development/install.html
9595

9696

97+
Modifying ``hoverxref.js`` on the fly
98+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99+
100+
Instead of rebuilding the whole project,
101+
we can modify the Javascript file that has the ``hoverxref_api_host`` hardcoded to point it to our local instance.
102+
103+
#. Open the documentation page you want to try on Google Chrome
104+
#. Press :kbd:`F12`
105+
#. Go to the :guilabel:`Sources`
106+
#. Find out the file ``js/hoverxref.js``
107+
#. Modify the function ``getEmbedURL`` to point the ``url`` variable to the local instance:
108+
109+
* ``/_`` to use the proxied API
110+
* ``http://community.dev.readthedocs.io`` to use the regular API
111+
112+
113+
.. tip::
114+
115+
This trick is useful for online documentation we don't control and want to test a change in the backend works as we expect.
116+
However, to do this, you will need to allow insecure content in your Chrome instance first:
117+
118+
.. prompt:: bash
119+
120+
google-chrome-stable --allow-running-insecure-content --user-data-dir='/tmp/testing'
121+
122+
97123
Permanent tooltip to work with CSS
98124
----------------------------------
99125

0 commit comments

Comments
 (0)