Writing Guidelines¶
In general, when creating reST documentation for the QGIS project, please follow the Python documentation style guidelines. For convenience, we provide a set of general rules we rely on for writing QGIS documentation below.
Rédiger la Documentation¶
Titres de chapitre¶
À chaque page web de la documentation correspond un fichier « .rst ».
Les différentes parties qui structurent le texte sont identifiées par leur titre qui est souligné (et surligné pour le premier niveau). Les titres de même niveau doivent utiliser le même caractère de soulignement. Dans la documentation QGIS, voici les styles à utiliser pour le chapitre, la section, la sous-section et la mini section.
********
Chapter
********
Section
=======
Subsection
----------
Minisec
.......
Subminisec
^^^^^^^^^^
Listes¶
Lists are useful for structuring the text. Here are some simple rules common to all lists:
Start all list items with a capital letter
Do not use punctuation after list items that only contain a single simple sentence
Use period (
.
) as punctuation for list items that consist of several sentences or a single compound sentence
Balises en ligne¶
Quelques balises peuvent être utilisées dans le texte pour mettre en valeur certains éléments.
Interface de menu : pour indiquer une séquence de sélections dans un menu, y compris la sélection de sous-menus et le choix d’une opération particulière, ou n’importe quelle sous-séquence d’une telle séquence.
:menuselection:`menu --> submenu`
Titre de fenêtres et d’onglets : Libellés faisant partie d’une boite de dialogue interactive y compris le titre de la fenêtre, le titre des onglets et le libellé des options.
:guilabel:`title`
Nom de fichier ou de répertoire
:file:`README.rst`
Icone et texte du popup de l’icone
|icon| :sup:`popup_text`
(voir image ci-dessous).
Raccourcis clavier
:kbd:`Ctrl+B`
affichera Ctrl+B
When describing keyboard shortcuts, the following conventions should be used:
Letter keys are displayed using uppercase: S
Special keys are displayed with an uppercase first letter: Esc
Key combinations are displayed with a
+
sign between keys, without spaces: Shift+R
Texte utilisateur
``label``
Étiquette/référence¶
Les références servent de repères dans le texte. Cela facilite la création et l’utilisation d’hyperliens entre les sections ou les pages.
L’exemple ci-dessous crée la référence d’une section (e.g., Libellé/titre de la référence)
.. _my_anchor:
Label/reference
---------------
Pour appeler la référence dans la même page, utilisez
see my_anchor_ for more information.
qui renverra :
voir my_anchor pour plus d’informations.
Remarquez que le lien vous amènera à l’élément situé immédiatement après “l’ancre”. Normalement, pour déclarer cette référence, il n’est pas nécessaire d’utiliser des apostrophes mais il faut une ligne vide avant et après “l’ancre”.
Une autre façon de créer un lien accessible depuis n’importe où dans la documentation est d’utiliser :ref:
.
see :ref:`my_anchor` for more information.
qui affichera la légende à la place (dans ce cas le titre de la section!):
voir Étiquette/référence pour plus d’informations.
On a donc référence 1 (my_anchor) et référence 2 (Étiquette/référence). Parce que la référence affiche souvent une description complète, il n’est pas vraiment utile d’utiliser le mot section. Notez que vous pouvez aussi utiliser une description personnalisée pour la référence
see :ref:`Label and reference <my_anchor>` for more information.
renvoyant :
voir Label and reference pour d’avantage de détails.
Figures and Images¶
Illustrations¶
Pour insérer une image, utilisez
.. image:: /static/common/logo.png
:width: 10 em
qui renvoie

Remplacement¶
You can put an image inside text or add an alias to use everywhere. To use an image
inside a paragraph, first create an alias in the source/substitutions.txt
file:
.. |nice_logo| image:: /static/common/logo.png
:width: 2 em
and then call it in your paragraph:
My paragraph begins here with a nice logo |nice_logo|.
This is how the example will be displayed:
My paragraph begins here with a nice logo .
In order to render in GitHub a preview of the documentation that is the closest
to html rendering, you will also need to add the image replacement call at the
end of the file you changed. This can be done by copy-pasting it from the
substitutions.txt
or by executing the scripts/find_set_subst.py
script.
Note
Currently, to ensure consistency and help in the use of QGIS icons a list of aliases is built and available in the Substitutions chapter.
Figure¶
.. _figure_logo:
.. figure:: /static/common/logo.png
:width: 20 em
:align: center
A caption: A logo I like
Le résultat ressemble à ceci :

Un titre : Un logo que j’aime¶
To avoid possible conflict with other references, always begin figure
anchors with _figure_
and prefer using terms that can easily refer to the
figure caption. While only the centered alignment is mandatory for the image,
feel free to use any other options for figures (such as width
,
height
, scale
…) if needed.
The scripts will insert an automatically generated number before the caption of the figure in the generated PDF version of the documentation.
Pour utiliser un titre (voir Mon titre) insérez juste un texte indenté après une ligne blanche dans le bloc de la figure.
La référence à la figure peut être faite en utilisant l’étiquette de la référence comme ceci :
(see Figure_logo_).
Il montrera l’ancre Figure_logo. Vous pouvez utiliser des majuscules si vous le souhaitez. Il peut être utilisé dans le même fichier .rst
mais pas dans les autres. Vous pouvez toujours utiliser le rôle : ref:
le référencer à partir d’autres fichiers, mais gardez à l’esprit que cela renvoie la légende complète de l’image.
see :ref:`figure_logo`
renvoie :
Tables¶
Pour créer une table simple
======= ======= =======
x y z
======= ======= =======
1 2 3
2 4
======= ======= =======
Utilisez un \
suivi par un espace vide pour laisser un espace vide.
Vous pouvez aussi utiliser des tableaux plus compliqués en les dessinant avec des références etc.
.. _my_drawn_table:
+---------------+--------------------+
| Windows | macOS |
+---------------+--------------------+
| |win| | |osx| |
+---------------+--------------------+
| and of course not to forget |nix| |
+------------------------------------+
My drawn table, mind you this is unfortunately not regarded as a caption
You can reference to it like this my_drawn_table_.
Le résultat :
Windows |
macOS |
My drawn table, mind you this is unfortunately not regarded as a caption
Vous pouvez le référencer comme ceci my_drawn_table.
Index¶
Un index est un moyen pratique d’aider le lecteur à trouver facilement une information dans un document. La documentation QGIS fournit les principaux index. Il y a quelques règles à suivre pour conserver un ensemble d’index vraiment utiles (cohérents, cohérents et vraiment connectés les uns aux autres):
An index should be human readable, understandable and translatable; an index can be made from many words but you should avoid any unneeded
_
,-
… characters to link them i.e.,Loading layers
instead ofloading_layers
orloadingLayers
.Always capitalize only the first letter of the index unless the word has a particular spelling, in which case keep using its spelling e.g.,
Loading layers
,Atlas generation
,WMS
,pgsql2shp
.Keep an eye on the existing Index list in order to reuse the most convenient expression with the right spelling and avoid wrong duplicates.
Il existe différents tags d’index dans le format RST. Vous pouvez soit utiliser le tag :index:
à l’intérieur de votre paragraphe.
QGIS allows to load several :index:`Vector formats` supported by GDAL/OGR ...
Ou vous pouvez utiliser le tag .. index::
de niveau paragraphe et qui précède la section en question. Du fait des règles mentionnées précédemment, il est conseillé de privilégier cette seconde forme car plus facile à utiliser.
.. index:: WMS, WFS, Loading layers
It’s also recommanded to use index parameters such as single
, pair
,
see
… in order to build a more structured and interconnected table of index.
See Index generating
for more information on index creation.
Commentaires Spéciaux¶
Sometimes, you may want to emphasize some points of the description, either to
warn, remind or give some hints to the user. In QGIS Documentation, we use reST
special directives such as .. warning::
, .. note::
and .. tip::
generating particular frames that highlight your comments. See Paragraph Level markup
for more information.
A clear and appropriate title is required for both warnings and tips.
.. tip:: **Always use a meaningful title for tips**
Begin tips with a title that summarizes what it is about. This helps
users to quickly overview the message you want to give them, and
decide on its relevance.
Extraits de code¶
Vous pouvez également donner des exemples et insérer un extrait de code. Dans ce cas, écrivez le commentaire sous une ligne contenant l’instruction ::
. Cependant, pour un meilleur rendu, en particulier pour appliquer la mise en surbrillance des couleurs au code en fonction de son langage, utilisez l’instruction code-bloc, par ex. .. code-block:: xml
. Plus de détails dans Affichage de code.
Note
Alors que le texte dans les notes, astuces et avertissements sont traduisibles, sachez que les blocs de code ne permettent pas la traduction. Évitez donc les commentaires qui ne sont pas liés à l’exemple de code et gardez-le aussi court que nécessaire.
Notes de pied de page¶
Attention : les notes de pied de page ne sont pas reconnues par les logiciels de traduction et ne sont pas converties correctement dans le format PDF. Donc, si possible, n’utilisez pas les notes de pied de page dans une documentation.
This is for creating a footnote (showing as example 1)
blabla [1]_
qui pointera vers :
- 1
Mise à jour des extensions principales
Les Captures d’écrans¶
Ajouter de nouvelles captures d’écran¶
Here are some hints to create new, nice looking screenshots.
The images should be placed in a img/
folder, in the same folder as the
referencing .rst
file.
You can find some prepared QGIS-projects that are used to create screenshots in the
./qgis-projects
folder of this repository. This makes it easier to reproduce screenshots for the next version of QGIS. These projects use the QGIS Sample Data (aka Alaska Dataset), which should be placed in the same folder as the QGIS-Documentation Repository.Reduce the window to the minimal space needed to show the feature (taking the whole screen for a small modal window > overkill)
The less clutter, the better (no need to activate all the toolbars)
Don’t resize them in an image editor; the size will be set into the
.rst
files if necessary (downscaling the dimensions without properly upping the resolution > ugly)Cut the background
Make the top corners transparent if the background is not white
Set print size resolution to
135 dpi
(e.g. in Gimp set the print resolution and save). This way, images will be at original size in html and at a good print resolution in the PDF. You can also use ImageMagick convert command to do a batch of images:convert -units PixelsPerInch input.png -density 135 output.png
Save them in
.png
(no.jpeg
artifacts)The screenshot should show the content according to what is described in the text
Astuce
If you are on Ubuntu, you can use the following command to remove the global menu function and create smaller application screens with menus:
sudo apt autoremove appmenu-gtk appmenu-gtk3 appmenu-qt
Traduire les captures d’écran¶
Here are some hints to create screenshots for your translated user guide.
Translated images should be placed in a img/<your_language>/
folder, in
the same folder as the referencing .rst
file.
Use the QGIS projects included in QGIS-Documentation repository (in
./qgis_projects
) These were used to produce the “original” screenshots in the manual. The QGIS Sample Data (aka Alaska Dataset) should be placed in the same folder as the QGIS-Documentation Repository.Same filename as the english “original” screenshot
Reduce the window to the minimal space needed to show the feature (taking the whole screen for a small modal window > overkill)
The less clutter, the better (no need to activate all the toolbars)
Don’t resize them in an image editor; the size will be set into the
.rst
files if necessary (downscaling the dimensions without properly upping the resolution > ugly)Cut the background
Save them in
.png
(no.jpeg
artifacts)The screenshot should show the content according to what is described in the text
Documenter les algorithmes de traitement¶
Si vous désirez écrire de la documentation pour des algorithmes de Traitement, merci de suivre ces recommandations :
Processing algorithm help files are part of QGIS User Guide, so use the same formatting as User Guide and other documentation.
Each algorithm documentation should be placed in the corresponding provider folder and group file, e.g. the algorithm Voronoi polygon belongs to the QGIS provider and to the group vectorgeometry. So the correct file to add the description is:
source/docs/user_manual/processing_algs/qgis/vectorgeometry.rst
.Note
Before starting to write the guide, check if the algorithm is already described. In this case, you can enhance the existing description.
It is extremely important that each algorithm has an anchor that corresponds to the provider name + the unique name of the algorithm itself. This allows the Help button to open the Help page to the correct section. The anchor should be placed above the title, e.g. (see also the Étiquette/référence section):
.. _qgisvoronoipolygons: Voronoi polygons ----------------
To find out the algorithm name you can just hover the mouse on the algorithm in the Processing toolbox.
Avoid use « This algorithm does this and that… » as first sentence in algorithm description. Try to use more general expressions like:
Takes a point layer and generates a polygon layer containing the...
Avoid to describe what the algorithm does by replicating its name and please don’t replicate the name of the parameter in the description of the parameter itself. For example if the algorithm is
Voronoi polygon
consider to describe theInput layer
likeLayer to calculate the polygon from
.Indicate in the description whether the algorithm has a default shortcut in QGIS or supports in-place editing.
Add images! A picture is worth a thousand words! Use
.png
format and follow general guidelines for documentation (see the Figures and Images section for more info). Put the image file in the correct folder, i.e. theimg
folder next to the.rst
file you are editing.If necessary, add links to the « See also » section that provides additional information about the algorithm (e.g., publications or web-pages). Only add the « See also » section if there is really something to see. As a good practice, the « See also » section can be filled with links to similar algorithms.
Give clear explanation for algorithm parameters and outputs: take inspiration from existing algorithms.
Avoid to duplicate algorithm options detailed description. Add these information in the parameter description.
Avoid to add information about the vector geometry type in algorithm or parameter description without compelling reason as this information is already available in parameter description.
Add the default value of the parameter in italic, e.g.:
``Number of points`` [number] Number of points to create Default: *1*
Describe the type of input supported the parameters. There are several types available you can pick one from:
Parameter/Output type
Description
Indicateur visuel
Couche vecteur de points
vecteur : point
Couche vecteur de lignes
vecteur : ligne
Couche vecteur de polygones
vecteur : polygone
Generic vector layer
vector: any
Vector field numeric
tablefield: numeric
Vector field string
tablefield: string
Vector field generic
tablefield: any
Couche raster
raster
Raster band
raster band
Fichier HTML
HTML
Table layer
table
Expression
expression
Point geometry
coordinates
Extent
extent
CRS
crs
Enumeration
enumeration
Liste
liste
Nombre
number
String
string
Boolean
boolean
Folder path
folder
The best option is studying an existing and well documented algorithm and copy all the useful layouts
If the algorithm does not provide any output just skip that section
Quand vous avez fini, suivez simplement les explications dans le Une contribution étape par étape pour valider vos modification et faire une demande de fusion de branches.
Here is an example of an existing algorithm to help you with the layout and the description:
.. _qgiscountpointsinpolygon:
Count points in polygon
-----------------------
Takes a point and a polygon layer and counts the number of points from the
point layer in each of the polygons of the polygon layer.
A new polygon layer is generated, with the exact same content as the input polygon
layer, but containing an additional field with the points count corresponding to
each polygon.
.. figure:: img/count_points_polygon.png
:align: center
The labels in the polygons show the point count
An optional weight field can be used to assign weights to each point. Alternatively,
a unique class field can be specified. If both options are used, the weight field
will take precedence and the unique class field will be ignored.
``Default menu``: :menuselection:`Vector --> Analysis Tools`
Parameters
..........
.. list-table::
:header-rows: 1
:widths: 20 20 20 40
:stub-columns: 0
* - Label
- Name
- Type
- Description
* - **Polygons**
- ``POLYGONS``
- [vector: polygon]
- Polygon layer whose features are associated with the count of
points they contain
* - **Points**
- ``POINTS``
- [vector: point]
- Point layer with features to count
* - **Weight field**
Optional
- ``WEIGHT``
- [tablefield: numeric]
- A field from the point layer.
The count generated will be the sum of the weight field of the
points contained by the polygon.
* - **Class field**
Optional
- ``CLASSFIELD``
- [tablefield: any]
- Points are classified based on the selected attribute and if
several points with the same attribute value are within the
polygon, only one of them is counted.
The final count of the points in a polygon is, therefore, the
count of different classes that are found in it.
* - **Count field name**
- ``FIELD``
- [string]
Default: 'NUMPOINTS'
- The name of the field to store the count of points
* - **Count**
- ``OUTPUT``
- [vector: polygon]
Default: [Create temporary layer]
- Specification of the output layer type (temporary, file,
GeoPackage or PostGIS table).
Encoding can also be specified.
Outputs
.......
.. list-table::
:header-rows: 1
:widths: 20 20 20 40
:stub-columns: 0
* - Label
- Name
- Type
- Description
* - **Count**
- ``OUTPUT``
- [vector: polygon]
- Resulting layer with the attribute table containing the
new column with the points count