4
4
Shared Include
5
5
==============
6
6
7
- The ``sharedinclude`` directive allows you to source content from a file
8
- located in the MongoDB internal `docs-shared <https://github.com/10gen/docs-shared>`__
7
+ The ``sharedinclude`` directive lets you source content from a file located in
8
+ the MongoDB internal `docs-shared <https://github.com/10gen/docs-shared>`__
9
9
repository. Use this directive when you need to keep the same content in sync
10
10
for multiple sets of documentation or multiple branches of a documentation set.
11
11
12
12
This page uses the following terms:
13
13
14
- - **External file**: content committed to the ``docs-shared`` repository
15
- that can be sourced by other documentation repositories.
16
- - **Sourcing file**: content in a documentation repository that uses a
17
- ``sharedinclude`` directive to pull content from an external file.
18
- - **Placeholder**: a variable that indicates text that the sourcing file
19
- must provide a replacement for. These are located in external files and are
20
- represented by the placeholder name surrounded by the ``|`` (pipe)
21
- character.
14
+ External file
15
+ Content committed to the ``docs-shared`` repository that other documentation
16
+ repositories can source.
17
+
18
+ Sourcing file
19
+ Content in a documentation repository that uses a ``sharedinclude``
20
+ directive to pull content from an external file.
21
+
22
+ Placeholder
23
+ A variable that indicates text that the sourcing file must provide a
24
+ replacement for. These variables are represented by the placeholder name
25
+ surrounded by the ``|`` (pipe) character. The variables are used in
26
+ external files.
22
27
23
28
.. tip::
24
29
@@ -33,14 +38,14 @@ This page uses the following terms:
33
38
Setup
34
39
-----
35
40
36
- You must add the URL from which to source the shared content in the
37
- ``sharedinclude_root`` setting of the documentation repository's ``snooty.toml``
38
- configuration file . This should reference the unprocessed versions of the files,
39
- currently served from the ``raw.githubusercontent.com`` domain.
41
+ You must ensure the ``sharedinclude_root`` setting in the documentation
42
+ repository's ``snooty.toml`` configuration file is set to the shared
43
+ content repository URL . This URL must point to the unprocessed version of the
44
+ files, currently served from the ``raw.githubusercontent.com`` domain.
40
45
41
- If the shared content that your docs repository file references is on the
42
- ``main`` branch of ``docs-snooty ``, your ``snooty.toml`` configuration entry
43
- should resemble the following line:
46
+ For example, if the external files that your docs repository file references
47
+ is on the ``main`` branch of ``docs-shared ``, your docs repository
48
+ ``snooty.toml`` configuration entry should resemble the following line:
44
49
45
50
.. code-block::
46
51
@@ -54,11 +59,11 @@ Syntax
54
59
------
55
60
56
61
To include content from an external file, add the ``sharedinclude`` directive
57
- to the sourcing file. Specify the path of external file relative to the
62
+ to the sourcing file. Specify the path of the external file relative to the
58
63
``docs-shared`` base directory, omitting the leading slash.
59
64
60
65
For example, if the file path from the root of the ``docs-shared`` repository
61
- is ``drivers/compatibility-tables/c.rst``, the rST in the sourcing file
66
+ is ``drivers/compatibility-tables/c.rst``, the {+rst-abbrev+} in the sourcing file
62
67
should include the following code:
63
68
64
69
.. code-block:: rst
@@ -112,17 +117,21 @@ Placeholders in Inline Context
112
117
``````````````````````````````
113
118
114
119
An **inline context** describes the positioning of placeholders as adjacent to
115
- other paragraph text. You can only replace variable placeholders in an inline
116
- context with values that contain markup elements which includes any of the
117
- following types:
120
+ other paragraph text. If the placeholder is in an inline context, you can
121
+ replace it with markup elements including the following types:
118
122
119
123
- Unformatted text
120
124
- Formatted text such as ``monospace``, **emphasis**, or *italic*
121
125
- Links
122
126
127
+ You cannot replace variable placeholders in inline contexts with elements
128
+ such as lists, code blocks, includes, and headers. If you need to
129
+ source these elements from a ``sharedinclude``, make sure the placeholders
130
+ are in a block context as described in the next section.
131
+
123
132
For example, suppose you want to source content from an external file, located
124
- at ``dbx/fundamentals/agg-operators.rst`` in the ``docs-shared`` repository,
125
- which contains the following content:
133
+ at ``dbx/fundamentals/agg-operators.rst`` in the ``docs-shared`` repository
134
+ that contains the following content:
126
135
127
136
.. code-block:: rst
128
137
:caption: dbx/fundamentals/agg-operators.rst external file in docs_shared
@@ -131,7 +140,6 @@ which contains the following content:
131
140
To learn more about **aggregation operators**, see the
132
141
|learn-agg-operator-docs|.
133
142
134
-
135
143
In the sourcing file, you can use the following placeholder replacement
136
144
in the ``sharedinclude`` directive:
137
145
@@ -146,27 +154,22 @@ in the ``sharedinclude`` directive:
146
154
Aggregation Operations page in the
147
155
:server:`MongoDB Server documentation </aggregation>`
148
156
149
- The published page renders as if the sourcing file contained the following rST:
157
+ The published page renders as if the sourcing file contained the following
158
+ {+rst-abbrev+}:
150
159
151
160
.. code-block:: rst
152
161
:copyable: false
153
162
154
163
To learn more about **aggregation operators**, see the Aggregation Operations
155
164
page in the :server:`MongoDB Server documentation </aggregation>`.
156
165
157
-
158
- You cannot replace variable placeholders in inline contexts with elements
159
- such as lists, codeblocks, includes, and headers. If you need to
160
- source these elements from a ``sharedinclude``,, make sure the placeholders
161
- are in a block context as described in the following section.
162
-
163
166
Placeholders in Block Context
164
167
`````````````````````````````
165
168
166
169
A **block context** describes the positioning of placeholders as
167
- separated from paragraph text by linebreaks . You can replace variable
168
- placeholders in a block context with most inline or block rST elements
169
- including the following types:
170
+ separated from paragraph text by line breaks . You can replace variable
171
+ placeholders in a block context with most inline or block {+rst-abbrev+}
172
+ elements, including the following types:
170
173
171
174
- Titles
172
175
- Code blocks
@@ -175,7 +178,7 @@ including the following types:
175
178
176
179
For example, suppose you want to source content from an external file, located
177
180
at ``dbx/fundamentals/agg-operators.rst`` in the ``docs-shared`` repository,
178
- which containsk the following content:
181
+ which contains the following content:
179
182
180
183
.. code-block:: rst
181
184
:caption: dbx/fundamentals/agg-operators.rst external file in docs_shared
@@ -211,7 +214,7 @@ in the ``sharedinclude`` directive:
211
214
212
215
{ <operator>: [ <argument1>, <argument2> ... ] }
213
216
214
- The published page renders as if the sourcing file contained the following rST :
217
+ The published page renders as if the sourcing file contained the following {+rst-abbrev+} :
215
218
216
219
.. code-block:: rst
217
220
:copyable: false
0 commit comments