Skip to content

Commit b3d9578

Browse files
committed
Update embed guide a bit
1 parent e552f8c commit b3d9578

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

docs/guides/embedding-content.rst

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,56 @@
1-
Embedding Content In Your Documentation
2-
=======================================
1+
Embedding Content From Your Documentation
2+
=========================================
33

4+
Read the Docs allows you to embed content from any of the projects we host.
5+
This allows reuse of content across sites, making sure the content is always up to date.
46

5-
Read the Docs allow you to embed content from any of the projects we host.
6-
This allows to re-use the content across sites, making sure the content is always up to date.
7+
There are a number of uses cases for embedding content,
8+
so we've built our integration in a way that enables users to build on top of it.
9+
This guide will show you some of our favorite integrations:
710

8-
There are many uses of our Embed API we can think about.
9-
However, we are sure there are even more and that's why we are exposing it publicly,
10-
so you can build your own idea on top of it.
11+
.. contents::
12+
:local:
1113

12-
These guide will show you two of our favorites ones:
1314

14-
* inline help on application website
15-
* contextualized tooltips on documentation pages
15+
Contextualized tooltips on documentation pages
16+
----------------------------------------------
17+
18+
Tooltips on your own documentation are really useful to add more context to the current page the user is reading.
19+
You can embed any content that is available via reference in Sphinx, including:
20+
21+
* Python object references
22+
* Full documentation pages
23+
* Sphinx references
24+
* Term definitions
25+
26+
We built a Sphinx extension called ``sphinx-hoverxref`` on top of our Embed API
27+
you can install in your project with minimal configuration.
28+
29+
Here is an example showing a tooltip when you hover with the mouse a reference:
30+
31+
.. figure:: /_static/images/guides/sphinx-hoverxref-example.png
32+
:width: 60%
33+
34+
Tooltip shown when hovering on a reference using ``sphinx-hoverxref``.
35+
36+
You can find more information about this extension, how to install and configure it in the `hoverxref documentation`_.
37+
38+
.. _hoverxref documentation: https://sphinx-hoverxref.readthedocs.io/
1639

1740

1841
Inline help on application website
1942
----------------------------------
2043

2144
This allows us to keep the official documentation as the single source of truth,
22-
while having great inline help in our application website as well:
23-
on a "Automation Rules" admin page we could embed the content of our :doc:`automation-rules` documentation
45+
while having great inline help in our application website as well.
46+
On the "Automation Rules" admin page we could embed the content of our :doc:`automation-rules` documentation
2447
page and be sure it will be always up to date.
2548

2649
.. note::
2750

2851
We recommend you point at tagged releases instead of latest.
2952
Tags don't change over time, so you don't have to worry about the content you are embedding disappearing.
3053

31-
3254
The following example will fetch the section "Creating an automation rule" in page ``automation-rules.html``
3355
from our own docs and will populate the content of it into the ``#help-container`` div element.
3456

@@ -49,40 +71,18 @@ from our own docs and will populate the content of it into the ``#help-container
4971

5072
<div id="help-container"></div>
5173

52-
5374
You can modify this example to subscribe to ``.onclick`` Javascript event,
5475
and show a modal when the user clicks in a "Help" link.
5576

56-
57-
Contextualized tooltips on documentation pages
58-
----------------------------------------------
59-
60-
Tooltips on your own documentation are really useful to add more context to the current page the user is reading.
61-
For example, embed terms definitions, Python functions or classes definitions, configurations of your application,
62-
or the content of any other reference.
63-
64-
We built a Sphinx extension called ``sphinx-hoverxref`` on top of our Embed API
65-
that authors can just install in their project and get the most of it without the need of coding anything.
66-
67-
Here is an example showing a tooltip when you hover with the mouse a reference:
68-
69-
.. figure:: /_static/images/guides/sphinx-hoverxref-example.png
70-
71-
Tooltip shown when hovering on a reference using ``sphinx-hoverxref``.
72-
73-
You can find more information about this extension, how to install and configure it in `its own documentation here`_.
74-
75-
.. _its own documentation here: https://sphinx-hoverxref.readthedocs.io/
76-
77-
78-
Calling the Embed API
79-
---------------------
80-
77+
Calling the Embed API directly
78+
------------------------------
8179

8280
Embed API lives under ``https://readthedocs.org/api/v2/embed/`` URL and accept two different ways of using it:
83-
by passing the exact URL of the section you want to embed or sending all the attributes in a separate way.
8481

85-
The following links return exactly the same response, however the first one pass the ``url`` attribute
82+
* passing the exact URL of the section you want to embed
83+
* sending all the attributes required as GET arguments
84+
85+
The following links return exactly the same response, however the first one passes the ``url`` attribute
8686
and the second example sends ``project``, ``version``, ``doc``, ``section`` and ``path`` as different attributes.
8787
You can use the one that works best for your use case.
8888

0 commit comments

Comments
 (0)