You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/documentation/myst-reference.md
+68-23
Original file line number
Diff line number
Diff line change
@@ -91,44 +91,51 @@ Use [Shimmer](http://example.com) for cleaner whiter teeth.
91
91
```
92
92
93
93
94
-
### Images and figures
94
+
(media-specifications)=
95
95
96
-
[Figures](https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure) allow a caption and legend, whereas [images](https://docutils.sourceforge.io/docs/ref/rst/directives.html#images) do not.
97
-
However we can {ref}`enhance images with cards <enhance-images-label>` to add a caption and more features.
96
+
### Media specifications
98
97
99
-
Use `image`for anything but diagrams.
98
+
This section describes the specifications for images, figures, videos, diagrams, and other media.
100
99
101
-
Use `figure` for diagrams.
102
100
101
+
(width-of-media)=
103
102
104
-
(static-assets-label)=
103
+
#### Width of media
105
104
106
-
#### Static assets
105
+
The main content area of a page in the documentation is 790 pixels wide.
106
+
When taking screenshots or videos, resize your browser window, or try to limit the width of your media.
107
+
This will preserve legibility of images and videos when displayed inline.
107
108
108
-
When the documentation is in a submodule, paths to static assets—including, images, figures, and videos—must resolve in both the main documentation and the submodule's documentation.
109
+
If you {ref}`enhance-media-label`, constrain the width of your media to 760 pixels, to accommodate the padding and margins from the enhancement.
109
110
110
-
Inside the `docs` directory, place static assets in the `/_static/` directory, and preferably inside a subdirectory named after the part or page of the documentation.
111
-
For example, in the `volto` submodule, inside its `src/docs` directory, place an image at `/_static/user-manual/block-left-add-icon.png`.
112
-
In your markup, use that same `docs`-root-relative path for the target, such as `/_static/user-manual/block-left-add-icon.png`.
113
-
Don't use file-relative paths.
111
+
If you don't enhance media, constrain the width of your media to 790 pixels.
114
112
115
-
Configuration in the {file}`conf.py` files for the main documentation and its submodules handle the resolution of `docs`-root-relative paths for you.
116
113
114
+
(static-asset-paths-label)=
117
115
118
-
#### Width of media
116
+
#### Static asset paths
117
+
118
+
When the documentation is in a submodule, paths to static assets—including, images, figures, and videos—must resolve in both the main documentation and the submodule's documentation.
119
+
120
+
Inside the {file}`docs` directory of either main documentation or the submodule, place static assets in the {file}`/_static/` directory, and preferably inside a subdirectory named after the part or page of the documentation.
121
+
122
+
For example, in the main documentation, place an image at {file}`docs/_static/contributing/git-commit-submodule.jpg`.
123
+
Whereas, in the `volto` submodule, place an image inside it at {file}`src/docs/_static/user-manual/block-left-add-icon.png`.
119
124
120
-
The main content area of a page in the documentation is 743 pixels wide.
121
-
When taking screenshots or videos, resize your browser window, or try to limit the width of your media to 740 pixels.
122
-
This will preserve legibility of images.
125
+
If the static asset exists only in the main documentation and is referenced only from within the main documentation, then in your markup you should use a root-relative path for the media target, such as `/_static/contributing/git-commit-submodule.jpg`.
123
126
127
+
Otherwise, you should adjust your markup to use an appropriate relative path through the submodule.
128
+
For example, to refer to a video from within the `volto` submodule, use `../_static/user-manual/blocks/block-copy-cut.mp4`.
129
+
To refer to that same video from the main documentation, include the submodule's relative path `../../volto/_static/user-manual/blocks/block-copy-cut.mp4`.
124
130
125
-
(enhance-images-label)=
126
131
127
-
#### Enhance images
132
+
(enhance-media-label)=
133
+
134
+
#### Enhance media
128
135
129
136
You can use cards from the Sphinx extension [`sphinx-design`](https://sphinx-design.readthedocs.io/en/latest/cards.html) to enhance the display and functionality of images.
130
137
131
-
Cards allow the display of a caption, create a link to the source image to display when it is too large to fit within the documentation page without scaling, and add a border to demarcate the image from the page's white background.
138
+
Cards allow the display of a caption, create a link to the source image to display when it is too large to fit within the documentation page without scaling, and add a border to demarcate the image from the page's background color.
132
139
133
140
The following MyST example will display as shown below.
134
141
@@ -164,6 +171,30 @@ The following MyST example will display as shown below.
164
171
````
165
172
166
173
174
+
### Images and figures
175
+
176
+
[Figures](https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure) allow a caption and legend, whereas [images](https://docutils.sourceforge.io/docs/ref/rst/directives.html#images) do not.
177
+
However, we can {ref}`enhance images with cards <enhance-media-label>` to add a caption and more features.
178
+
179
+
Use `image` for anything but diagrams.
180
+
181
+
Use `figure` for diagrams.
182
+
183
+
```{seealso}
184
+
{ref}`media-specifications`
185
+
```
186
+
187
+
188
+
#### Image example
189
+
190
+
The following is an example of an image that occupies the full width of the content area without {ref}`media enhancement <enhance-media-label>`.
191
+
192
+
````{example}
193
+
```{image} /_static/caching/caching-disabled.png
194
+
```
195
+
````
196
+
197
+
167
198
#### Inline images
168
199
169
200
For inline images, you can use the MyST extension [`html_image`](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#html-images).
@@ -214,9 +245,7 @@ If you include audio, it is helpful to include closed captions or a transcript.
214
245
It is helpful to include overlays of key strokes, and mouse and other input gestures, to describe how to interact with the user interface.
215
246
216
247
Paths to videos must resolve in both the main documentation and the submodule's documentation, if present.
217
-
Note that the path must be absolute to support both submodules and the main documentation.
218
-
Don't use file-relative paths.
219
-
See {ref}`static-assets-label` for details.
248
+
See {ref}`static-asset-paths-label` for details.
220
249
221
250
Example MyST syntax is shown below.
222
251
@@ -228,6 +257,10 @@ Example MyST syntax is shown below.
228
257
````
229
258
`````
230
259
260
+
```{seealso}
261
+
{ref}`media-specifications`
262
+
```
263
+
231
264
232
265
### Video - remote
233
266
@@ -268,6 +301,10 @@ For an in depth discussion of privacy issues, see [How to embed YouTube videos w
268
301
- Vimeo's [supported player parameters](https://help.vimeo.com/hc/en-us/articles/12426260232977-About-Player-parameters#h_01FNYA7F7GKWE17XDQJPMBC058)
269
302
```
270
303
304
+
```{seealso}
305
+
{ref}`media-specifications`
306
+
```
307
+
271
308
272
309
### Diagrams and graphs with Mermaid
273
310
@@ -303,6 +340,10 @@ block-beta
303
340
```
304
341
````
305
342
343
+
```{seealso}
344
+
{ref}`media-specifications`
345
+
```
346
+
306
347
307
348
### Diagrams and graphs with Graphviz
308
349
@@ -324,6 +365,10 @@ The following MyST example will display as shown below.
0 commit comments