1
- Embedding Content In Your Documentation
2
- =======================================
1
+ Embedding Content From Your Documentation
2
+ =========================================
3
3
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.
4
6
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:
7
10
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:
11
13
12
- These guide will show you two of our favorites ones:
13
14
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/
16
39
17
40
18
41
Inline help on application website
19
42
----------------------------------
20
43
21
44
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
24
47
page and be sure it will be always up to date.
25
48
26
49
.. note ::
27
50
28
51
We recommend you point at tagged releases instead of latest.
29
52
Tags don't change over time, so you don't have to worry about the content you are embedding disappearing.
30
53
31
-
32
54
The following example will fetch the section "Creating an automation rule" in page ``automation-rules.html ``
33
55
from our own docs and will populate the content of it into the ``#help-container `` div element.
34
56
@@ -49,40 +71,18 @@ from our own docs and will populate the content of it into the ``#help-container
49
71
50
72
<div id =" help-container" ></div >
51
73
52
-
53
74
You can modify this example to subscribe to ``.onclick `` Javascript event,
54
75
and show a modal when the user clicks in a "Help" link.
55
76
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
+ ------------------------------
81
79
82
80
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.
84
81
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
86
86
and the second example sends ``project ``, ``version ``, ``doc ``, ``section `` and ``path `` as different attributes.
87
87
You can use the one that works best for your use case.
88
88
0 commit comments