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/myst-reference.md
+93-11Lines changed: 93 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,27 +102,54 @@ Use [Shimmer](http://example.com) for cleaner whiter teeth.
102
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
111
Paths to images and figures must resolve in both the main documentation and the submodule's documentation, if present.
111
112
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.
114
113
115
-
```html
116
-
You can copy <imgalt="Copy icon"src="../../_images/copy.svg"class="inline"> blocks.
117
-
```
114
+
##### Width of media
118
115
119
-
Note that the HTML attribute `class` must be set to `inline` to render the image inline at `1rem`.
116
+
The main content area of a page in the documentation is 743 pixels wide.
117
+
When taking screenshots or videos, resize your browser window, or try to limit the width of your media to 740 pixels.
118
+
This will preserve legibility of images.
120
119
121
-
The above syntax renders as shown below.
122
120
123
-
> You can copy <imgalt="Copy icon"src="/_static/copy.svg"class="inline"> blocks.
121
+
(enhance-images-label)=
124
122
125
-
Images and figures should always include `alt` text.
123
+
##### Enhance images
124
+
125
+
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.
126
+
127
+
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.
128
+
129
+
The following MyST example will display as shown below.
130
+
131
+
`````md
132
+
````{card}
133
+
```{image} /_static/caching/caching-disabled.png
134
+
:alt: Caching Control Panel
135
+
:target: /_static/caching/caching-disabled.png
136
+
```
137
+
+++
138
+
_Caching Control Panel_
139
+
````
140
+
`````
141
+
142
+
````{card}
143
+
```{image} /_static/caching/caching-disabled.png
144
+
:alt: Caching Control Panel
145
+
:target: /_static/caching/caching-disabled.png
146
+
```
147
+
+++
148
+
_Caching Control Panel_
149
+
````
150
+
151
+
152
+
##### Accessibility with `alt` text
126
153
127
154
From [Web Accessibility In Mind (WebAIM)](https://webaim.org/techniques/alttext/):
128
155
@@ -133,6 +160,8 @@ From [Web Accessibility In Mind (WebAIM)](https://webaim.org/techniques/alttext/
133
160
134
161
Accessibility is part of the [Plone brand and identity](https://plone.org/accessibility).
135
162
163
+
The following MyST example will display as shown below.
164
+
136
165
````md
137
166
```{image} /_static/standards.png
138
167
:alt: XKCD "Standards" comic strip
@@ -143,6 +172,26 @@ Accessibility is part of the [Plone brand and identity](https://plone.org/access
143
172
:alt: XKCD "Standards" comic strip
144
173
```
145
174
175
+
176
+
##### Inline images
177
+
178
+
For inline images, we use the MyST extension [`html_image`](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#html-images).
179
+
Example syntax is shown below.
180
+
181
+
```html
182
+
You can copy <imgalt="Copy icon"src="../../_images/copy.svg"class="inline"> blocks.
183
+
```
184
+
185
+
Note that the HTML attribute `class` must be set to `inline` to render the image inline at `1rem`.
186
+
187
+
The above syntax renders as shown below.
188
+
189
+
> You can copy <imgalt="Copy icon"src="/_static/copy.svg"class="inline"> blocks.
190
+
191
+
Images and figures should always include `alt` text.
192
+
193
+
The following MyST example will display as shown below.
194
+
146
195
````md
147
196
```{eval-rst}
148
197
.. figure:: /_static/voting_flowchart.png
@@ -195,9 +244,9 @@ It is helpful to include overlays of key strokes, and mouse and other input gest
195
244
196
245
Paths to videos must resolve in both the main documentation and the submodule's documentation, if present.
@@ -211,6 +260,39 @@ The above MyST markup renders as shown below.
211
260
```
212
261
213
262
263
+
#### Diagrams and graphs with Graphviz
264
+
265
+
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.
266
+
267
+
The following MyST example will display as shown below.
268
+
269
+
````markdown
270
+
```{eval-rst}
271
+
.. graphviz::
272
+
:align: center
273
+
274
+
digraph viewstructure {
275
+
{
276
+
node [margin=5,shape=box]
277
+
}
278
+
ZCML -> {Python, Template};
279
+
}
280
+
```
281
+
````
282
+
283
+
```{eval-rst}
284
+
.. graphviz::
285
+
:align: center
286
+
287
+
digraph viewstructure {
288
+
{
289
+
node [margin=5,shape=box]
290
+
}
291
+
ZCML -> {Python, Template};
292
+
}
293
+
```
294
+
295
+
214
296
#### Code block
215
297
216
298
A Python code snippet without reStructuredText options, using a simple fence.
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