Skip to content

Commit 10e0a70

Browse files
authored
Merge branch '6.0' into test-rendering-views
2 parents 2c12506 + 9de2d11 commit 10e0a70

File tree

1 file changed

+68
-23
lines changed

1 file changed

+68
-23
lines changed

docs/contributing/documentation/myst-reference.md

+68-23
Original file line numberDiff line numberDiff line change
@@ -91,44 +91,51 @@ Use [Shimmer](http://example.com) for cleaner whiter teeth.
9191
```
9292

9393

94-
### Images and figures
94+
(media-specifications)=
9595

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
9897

99-
Use `image` for anything but diagrams.
98+
This section describes the specifications for images, figures, videos, diagrams, and other media.
10099

101-
Use `figure` for diagrams.
102100

101+
(width-of-media)=
103102

104-
(static-assets-label)=
103+
#### Width of media
105104

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.
107108

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.
109110

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.
114112

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.
116113

114+
(static-asset-paths-label)=
117115

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`.
119124

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`.
123126

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`.
124130

125-
(enhance-images-label)=
126131

127-
#### Enhance images
132+
(enhance-media-label)=
133+
134+
#### Enhance media
128135

129136
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.
130137

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.
132139

133140
The following MyST example will display as shown below.
134141

@@ -164,6 +171,30 @@ The following MyST example will display as shown below.
164171
````
165172

166173

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+
167198
#### Inline images
168199

169200
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.
214245
It is helpful to include overlays of key strokes, and mouse and other input gestures, to describe how to interact with the user interface.
215246

216247
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.
220249

221250
Example MyST syntax is shown below.
222251

@@ -228,6 +257,10 @@ Example MyST syntax is shown below.
228257
````
229258
`````
230259

260+
```{seealso}
261+
{ref}`media-specifications`
262+
```
263+
231264

232265
### Video - remote
233266

@@ -268,6 +301,10 @@ For an in depth discussion of privacy issues, see [How to embed YouTube videos w
268301
- Vimeo's [supported player parameters](https://help.vimeo.com/hc/en-us/articles/12426260232977-About-Player-parameters#h_01FNYA7F7GKWE17XDQJPMBC058)
269302
```
270303

304+
```{seealso}
305+
{ref}`media-specifications`
306+
```
307+
271308

272309
### Diagrams and graphs with Mermaid
273310

@@ -303,6 +340,10 @@ block-beta
303340
```
304341
````
305342

343+
```{seealso}
344+
{ref}`media-specifications`
345+
```
346+
306347

307348
### Diagrams and graphs with Graphviz
308349

@@ -324,6 +365,10 @@ The following MyST example will display as shown below.
324365
```
325366
````
326367

368+
```{seealso}
369+
{ref}`media-specifications`
370+
```
371+
327372

328373
### Code block
329374

0 commit comments

Comments
 (0)