| myst | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
(contributing-writing-docs-guide)=
This guide provides general help for writing documentation for Plone.
We use MyST, or Markedly Structured Text, a rich and extensible flavor of Markdown, for authoring training documentation.
MyST extends {term}Markdown by incorporating all the features of {term}reStructuredText and {term}Sphinx and its extensions.
Contributors are welcome to use either Markdown or MyST syntax.
MyST may be more familiar to reStructuredText authors.
MyST allows the use of a {term}fence and {rst-eval} to evaluate native reStructuredText.
This may be useful when Markdown does not provide sufficient flexibility, such as for figure.
The following are frequently used snippets and examples.
**Official MyST documentation**
- [The MyST Syntax Guide](https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html)
- [MyST Syntax Reference](https://myst-parser.readthedocs.io/en/latest/syntax/reference.html)
[The MyST Syntax Guide > Targets and Cross-Referencing](https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#targets-and-cross-referencing)
Here is how to set up and build the documentation locally {doc}`/contributing/setup-build`.Here is how to set up and build the documentation locally {doc}/contributing/setup-build.
(writing-docs-guide-link-heading-label)=
(writing-docs-guide-hello-heading-label)=
###### Hello Heading
Read the section {ref}`writing-docs-guide-link-heading-label`.(writing-docs-guide-hello-heading-label)=
Read the section {ref}writing-docs-guide-hello-heading-label.
(example-target-label)=
I have an HTML anchor above me.
Click the link to visit {ref}`my text <example-target-label>`.(example-target-label)=
I have an HTML anchor above me.
Click the link to visit {ref}my text <example-target-label>.
Use [Shimmer](http://example.com) for cleaner whiter teeth.Use Shimmer for cleaner whiter teeth.
Figures allow a caption and legend, whereas images do not.
Use image for anything but diagrams.
Use figure for diagrams.
Images and figures should always include alt text.
From Web Accessibility In Mind (WebAIM):
Alternative text serves several functions:
- It is read by screen readers in place of images allowing the content and function of the image to be accessible to those with visual or certain cognitive disabilities.
- It is displayed in place of the image in browsers if the image file is not loaded or when the user has chosen not to view images.
- It provides a semantic meaning and description to images which can be read by search engines or be used to later determine the content of the image from page context alone.
Accessibility is part of the Plone brand and identity.
```{image} /_static/standards.png
:alt: XKCD "Standards" comic strip
```:alt: XKCD "Standards" comic strip
```{eval-rst}
.. figure:: /_static/voting_flowchart.png
:alt: Voting flowchart
This is a caption in a single paragraph.
This is a legend, which consists of all elements after the caption.
It can include a table.
====== =======
Symbol Meaning
====== =======
⃞ Object
⬭ View
➞ Flow
====== =======
```.. figure:: /_static/voting_flowchart.png
:alt: Voting flowchart
This is a caption in a single paragraph.
This is a legend, which consists of all elements after the caption.
It can include a table.
====== =======
Symbol Meaning
====== =======
⃞ Object
⬭ View
➞ Flow
====== =======
A Python code snippet without reStructuredText options, using a simple fence.
```python
a = 2
print("my 1st line")
print(f"my {a}nd line")
```a = 2
print("my 1st line")
print(f"my {a}nd line")A Python code snippet with reStructuredText options, using a fence with the parsed reStructuredText directive code-block.
```{code-block} python
:linenos:
:emphasize-lines: 1, 3
a = 2
print("my 1st line")
print(f"my {a}nd line")
```:linenos:
:emphasize-lines: 1, 3
a = 2
print("my 1st line")
print(f"my {a}nd line")
This is MyST syntax for term ``{term}`React` ``This is MyST syntax for term {term}`React`
Add a term to the {ref}glossary-label, located at {file}/glossary.md.
React
[React](https://reactjs.org/) is a JavaScript library for building user interfaces.
Volto, the frontend for Plone 6, uses React.Reference a term in the {ref}glossary-label.
Using {term}`React` makes frontends fun again!Using {term}React makes frontends fun again!
You can nest directives, such as admonitions and code blocks, by ensuring that the backtick-lines corresponding to the outermost directive are longer than the backtick-lines for the inner directives.
````{tip}
To use formatted string literals ("f-strings"), begin a string with `f` or `F` before the opening quotation mark or triple quotation mark.
Inside this string, you can write a Python expression between `{` and `}` characters that can refer to variables or literal values.
```{code-block} python
:linenos:
:emphasize-lines: 1, 3
a = 2
print("my 1st line")
print(f"my {a}nd line")
```
````
This would be rendered as:
To use formatted string literals ("f-strings"), begin a string with `f` or `F` before the opening quotation mark or triple quotation mark.
Inside this string, you can write a Python expression between `{` and `}` characters that can refer to variables or literal values.
```{code-block} python
:linenos:
:emphasize-lines: 1, 3
a = 2
print("my 1st line")
print(f"my {a}nd line")
```
We use several extensions to enhance the presentation of Plone documentation.
sphinx.ext.intersphinxprovides linking between separate projects that use Sphinx for documentation.sphinx.ext.todoadds support for todo items.sphinx_copybuttonadds a little "copy" button to the right of code blocks.sphinx-designadds grids, cards, icons, badges, buttons, tabs, and dropdowns.sphinx_sitemapgenerates multiversion and multilanguage sitemaps.org compliant sitemaps.sphinxcontrib.httpdomainprovides a Sphinx domain for describing HTTP APIs. It is used by Plone's {doc}plone.restapi/docs/source/index.sphinxcontrib.httpexampleenhancessphinxcontrib-httpdomainby generating RESTful HTTP API call examples for different tools from a single HTTP request example. Supported tools include curl, wget, httpie, and python-requests. It is used by Plone's {doc}plone.restapi/docs/source/index.sphinxcontrib.spellingprovides spell checking.sphinxext.opengraphgenerates OpenGraph metadata.sphinx.ext.viewcodegenerates pages of source code modules and links between the source and the description. It is used by {doc}/plone.api/index.sphinx.ext.autosummarygenerates function/method/attribute summary lists. It is used by {doc}/plone.api/index.
Guides should be informational, but friendly.
Address the reader by using "you" instead of "the user".
Avoid contractions, and spell out the words. For example, use "do not" instead of "don't".
Please do not follow PEP8 maximum line length standard. Documentation is narrative text and images, not Python code.
Use one sentence per line. Keep sentences short and understandable. This will greatly improve the editing and maintenance of your documentation.
Because it is difficult to automate good English grammar and syntax, we do not strictly enforce it. We also understand that contributors might not be fluent in English. We encourage contributors to make a reasonable effort, and to seek help from community members who are fluent in English. Please ask!