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
@@ -99,30 +99,69 @@ Use [Shimmer](http://example.com) for cleaner whiter teeth.
99
99
Use [Shimmer](http://example.com) for cleaner whiter teeth.
100
100
101
101
102
-
####Images and figures
102
+
### Images and figures
103
103
104
104
[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.
105
+
However we can {ref}`enhance images with cards <enhance-images-label>` to add a caption and more features.
105
106
106
107
Use `image` for anything but diagrams.
107
108
108
109
Use `figure` for diagrams.
109
110
110
-
Paths to images and figures must resolve in both the main documentation and the submodule's documentation, if present.
111
111
112
-
For inline images, we use the MyST extension [`html_image`](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#html-images).
113
-
Example syntax is shown below.
112
+
(static-assets-label)=
114
113
115
-
```html
116
-
You can copy <imgalt="Copy icon"src="../../_images/copy.svg"class="inline"> blocks.
117
-
```
114
+
#### Static assets
118
115
119
-
Note that the HTML attribute `class` must be set to `inline` to render the image inline at `1rem`.
116
+
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.
120
117
121
-
The above syntax renders as shown below.
118
+
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.
119
+
For example, in the `volto` submodule, inside its `src/docs` directory, place an image at `/_static/user-manual/block-left-add-icon.png`.
120
+
In your markup, use that same `docs`-root-relative path for the target, such as `/_static/user-manual/block-left-add-icon.png`.
121
+
Don't use file-relative paths.
122
122
123
-
> You can copy <imgalt="Copy icon"src="/_static/copy.svg"class="inline"> blocks.
123
+
Configuration in the `conf.py` files for the main documentation and its submodules handle the resolution of `docs`-root-relative paths for you.
124
124
125
-
Images and figures should always include `alt` text.
125
+
126
+
#### Width of media
127
+
128
+
The main content area of a page in the documentation is 743 pixels wide.
129
+
When taking screenshots or videos, resize your browser window, or try to limit the width of your media to 740 pixels.
130
+
This will preserve legibility of images.
131
+
132
+
133
+
(enhance-images-label)=
134
+
135
+
#### Enhance images
136
+
137
+
We 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.
138
+
139
+
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.
140
+
141
+
The following MyST example will display as shown below.
142
+
143
+
`````md
144
+
````{card}
145
+
```{image} /_static/caching/caching-disabled.png
146
+
:alt: Caching Control Panel
147
+
:target: /_static/caching/caching-disabled.png
148
+
```
149
+
+++
150
+
_Caching Control Panel_
151
+
````
152
+
`````
153
+
154
+
````{card}
155
+
```{image} /_static/caching/caching-disabled.png
156
+
:alt: Caching Control Panel
157
+
:target: /_static/caching/caching-disabled.png
158
+
```
159
+
+++
160
+
_Caching Control Panel_
161
+
````
162
+
163
+
164
+
#### Accessibility with `alt` text
126
165
127
166
From [Web Accessibility In Mind (WebAIM)](https://webaim.org/techniques/alttext/):
128
167
@@ -133,6 +172,8 @@ From [Web Accessibility In Mind (WebAIM)](https://webaim.org/techniques/alttext/
133
172
134
173
Accessibility is part of the [Plone brand and identity](https://plone.org/accessibility).
135
174
175
+
The following MyST example will display as shown below.
176
+
136
177
````md
137
178
```{image} /_static/standards.png
138
179
:alt: XKCD "Standards" comic strip
@@ -143,6 +184,26 @@ Accessibility is part of the [Plone brand and identity](https://plone.org/access
143
184
:alt: XKCD "Standards" comic strip
144
185
```
145
186
187
+
188
+
#### Inline images
189
+
190
+
For inline images, we use the MyST extension [`html_image`](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#html-images).
191
+
Example syntax is shown below.
192
+
193
+
```html
194
+
You can copy <imgalt="Copy icon"src="../../_images/copy.svg"class="inline"> blocks.
195
+
```
196
+
197
+
Note that the HTML attribute `class` must be set to `inline` to render the image inline at `1rem`.
198
+
199
+
The above syntax renders as shown below.
200
+
201
+
> You can copy <imgalt="Copy icon"src="/_static/copy.svg"class="inline"> blocks.
202
+
203
+
Images and figures should always include `alt` text.
204
+
205
+
The following MyST example will display as shown below.
206
+
146
207
````md
147
208
```{eval-rst}
148
209
.. figure:: /_static/voting_flowchart.png
@@ -182,7 +243,7 @@ Accessibility is part of the [Plone brand and identity](https://plone.org/access
182
243
```
183
244
184
245
185
-
####Video
246
+
### Video
186
247
187
248
To embed local videos, such as recordings of demonstrating the user interface, we require that the videos be saved as `.mp4` for greatest compatibility, usability, accessibility, and reduced file size.
188
249
@@ -194,24 +255,59 @@ If you include audio, it is helpful to include closed captions or a transcript.
194
255
It is helpful to include overlays of key strokes, and mouse and other input gestures, to describe how to interact with the user interface.
195
256
196
257
Paths to videos must resolve in both the main documentation and the submodule's documentation, if present.
We use [Graphviz](https://graphviz.org/download/) and its Sphinx extension [`sphinx.ext.graphviz`](https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html) to render diagrams and graph visualizations.
280
+
281
+
The following MyST example will display as shown below.
282
+
283
+
````markdown
284
+
```{eval-rst}
285
+
.. graphviz::
286
+
:align: center
287
+
288
+
digraph viewstructure {
289
+
{
290
+
node [margin=5,shape=box]
291
+
}
292
+
ZCML -> {Python, Template};
293
+
}
294
+
```
295
+
````
296
+
297
+
```{eval-rst}
298
+
.. graphviz::
299
+
:align: center
300
+
301
+
digraph viewstructure {
302
+
{
303
+
node [margin=5,shape=box]
304
+
}
305
+
ZCML -> {Python, Template};
306
+
}
307
+
```
308
+
309
+
310
+
### Code block
215
311
216
312
A Python code snippet without reStructuredText options, using a simple fence.
217
313
@@ -251,7 +347,7 @@ print("my 1st line")
251
347
print(f"my {a}nd line")
252
348
```
253
349
254
-
####Escape literal backticks inline
350
+
### Escape literal backticks inline
255
351
256
352
```md
257
353
This is MyST syntax for term ``{term}`React` ``
@@ -260,7 +356,7 @@ This is MyST syntax for term ``{term}`React` ``
260
356
This is MyST syntax for term ``{term}`React` ``
261
357
262
358
263
-
####Glossary terms
359
+
### Glossary terms
264
360
265
361
Add a term to the {ref}`glossary-label`, located at {file}`/glossary.md`.
Copy file name to clipboardExpand all lines: docs/contributing/sphinx-extensions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ myst:
13
13
14
14
We use several Sphinx extensions to enhance the presentation of Plone documentation.
15
15
16
+
-[`sphinx.ext.graphviz`](https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html) allows you to embed [Graphviz](https://graphviz.org/download/) graphs in your documents.
16
17
-[`sphinx.ext.intersphinx`](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html) provides linking between separate projects that use Sphinx for documentation.
17
18
-[`sphinx.ext.todo`](https://www.sphinx-doc.org/en/master/usage/extensions/todo.html) adds support for todo items.
18
19
-[`sphinx_copybutton`](https://sphinx-copybutton.readthedocs.io/en/latest/index.html) adds a little "copy" button to the right of code blocks.
0 commit comments