|
| 1 | +# Contributing Rules |
| 2 | + |
| 3 | +This guide provides guidelines for contributing to IT-Wallet Technical Documentation. Following these conventions ensures consistency across all documentation files. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Contributing Rules](#contributing-rules) |
| 8 | + - [Table of Contents](#table-of-contents) |
| 9 | + - [General Formatting and Editorial Conventions](#general-formatting-and-editorial-conventions) |
| 10 | + - [File Organization](#file-organization) |
| 11 | + - [Section Headers](#section-headers) |
| 12 | + - [Cross-References](#cross-references) |
| 13 | + - [Internal References](#internal-references) |
| 14 | + - [Referencing External Resources](#referencing-external-resources) |
| 15 | + - [Referencing RFC Documents](#referencing-rfc-documents) |
| 16 | + - [Important Syntax Notes](#important-syntax-notes) |
| 17 | + - [Figures and Images](#figures-and-images) |
| 18 | + - [Image Formats and Requirements](#image-formats-and-requirements) |
| 19 | + - [File Organization for Images](#file-organization-for-images) |
| 20 | + - [Adding Images to Documentation](#adding-images-to-documentation) |
| 21 | + - [SVG and PDF Images](#svg-and-pdf-images) |
| 22 | + - [PlantUML Diagrams](#plantuml-diagrams) |
| 23 | + - [Image Attributes](#image-attributes) |
| 24 | + - [Cross-Referencing Figures](#cross-referencing-figures) |
| 25 | + - [Tables](#tables) |
| 26 | + - [Table Requirements](#table-requirements) |
| 27 | + - [Row and Cell Formatting](#row-and-cell-formatting) |
| 28 | + - [Cross-Referencing Tables](#cross-referencing-tables) |
| 29 | + - [Non-Normative Examples](#non-normative-examples) |
| 30 | + - [Inline Code Examples](#inline-code-examples) |
| 31 | + - [External Code Files](#external-code-files) |
| 32 | + - [Notes and Warnings](#notes-and-warnings) |
| 33 | + |
| 34 | +## General Formatting and Editorial Conventions |
| 35 | + |
| 36 | +- **Encoding**: Files should be saved with UTF-8 encoding |
| 37 | +- **Technical parameter names**, such as JSON fileds or HTTP parameters, must be enclosed in double backticks, i.e.: ``client_id``, ``redirect_uri``, ``authorization_details``. |
| 38 | +- **Example URLs** in non-normative examples must use not real domains (such as ``example.org``, ``wallet-provider.example.org``) and must not reference real production URLs |
| 39 | +- **File and path names**, use lowercase, and be separated by hyphens: ``credential-issuance.rst``, ``credential-issuance-endpoint.rst`` |
| 40 | +- **Titles**, use Title Case Style: Capitalize all major words in titles. Major words exclude articles (a, an, the), prepositions (on, in, of, etc.), coordinating conjunctions (and, or, but, etc.), and 'to'. |
| 41 | + |
| 42 | +## File Organization |
| 43 | + |
| 44 | +When creating multiple RST files: |
| 45 | + |
| 46 | +1. Create a main index file (e.g., `credential-issuance.rst`) |
| 47 | +2. Use the `toctree` directive to organize related files: |
| 48 | + |
| 49 | +```rst |
| 50 | +.. toctree:: |
| 51 | + :caption: Table of Contents |
| 52 | + :maxdepth: 3 |
| 53 | +
|
| 54 | + credential-issuance-high-level.rst |
| 55 | + credential-issuance-low-level.rst |
| 56 | + credential-issuance-endpoint.rst |
| 57 | +``` |
| 58 | + |
| 59 | +Parameters: |
| 60 | +- `:caption:` - add a caption to the toctree |
| 61 | +- `:maxdepth:` - the depth level to display in the table of contents |
| 62 | + |
| 63 | +## Section Headers |
| 64 | + |
| 65 | +Use the following characters for section levels, maintaining this hierarchy: |
| 66 | + |
| 67 | +``` |
| 68 | +Equal signs (=) for Sections |
| 69 | +============================ |
| 70 | + |
| 71 | +Hyphens (-) for Subsections |
| 72 | +--------------------------- |
| 73 | + |
| 74 | +Carets (^) for Subsubsections |
| 75 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 76 | + |
| 77 | +Double quotes (") for Paragraphs |
| 78 | +""""""""""""""""""""""""""""""" |
| 79 | + |
| 80 | +Dots (.) for Subparagraphs |
| 81 | +.......................... |
| 82 | +``` |
| 83 | + |
| 84 | +Section headers must have the same number of underline/overline characters as at least the length of the header text. |
| 85 | + |
| 86 | +## Cross-References |
| 87 | + |
| 88 | +### Internal References |
| 89 | + |
| 90 | +This Technical Documentation uses `sphinx.ext.autosectionlabel` with `autosectionlabel_prefix_document` set to `True`. |
| 91 | + |
| 92 | +Therefore, for cross-referencing within documents, use the `:ref:` role with the name of the document in which the section is referenced and the section tile, separated by a colon: |
| 93 | + |
| 94 | +```rst |
| 95 | +See :ref:`file-name:Section Title`. |
| 96 | +``` |
| 97 | + |
| 98 | +#### Referencing External Resources |
| 99 | + |
| 100 | +To reference external resources in your documentation: |
| 101 | + |
| 102 | +1. **Basic reference** - use underscore suffix: |
| 103 | + ```rst |
| 104 | + See `OpenID4VCI`_ for more information. |
| 105 | + ``` |
| 106 | + |
| 107 | +2. **Reference to specific section** - include section information: |
| 108 | + ```rst |
| 109 | + See Section 7.2 of [`OpenID4VCI`_]. |
| 110 | + ``` |
| 111 | + |
| 112 | +#### Referencing RFC Documents |
| 113 | + |
| 114 | +RFC documents use a special role syntax that differs from regular external references: |
| 115 | + |
| 116 | +```rst |
| 117 | +As defined in :rfc:`7519`. |
| 118 | +``` |
| 119 | + |
| 120 | +You can also reference specific sections within RFCs: |
| 121 | + |
| 122 | +```rst |
| 123 | +See :rfc:`6749#section-4.1.2.1`. |
| 124 | +``` |
| 125 | + |
| 126 | +These references will automatically link to the appropriate RFC document without needing an entry in `common_definitions.rst`. |
| 127 | + |
| 128 | +#### Important Syntax Notes |
| 129 | + |
| 130 | +- The reference name (e.g., `OpenID4VCI`) is case-sensitive |
| 131 | +- The trailing underscore (`_`) is required in the reference usage |
| 132 | +- When using brackets, the backtick+text+backtick+underscore combination must be exact: [`text`_] |
| 133 | +- Always use backticks (`) and not single quotes (') around reference names |
| 134 | +- Reference definitions in `common_definitions.rst` start with `.. _` (dot dot space underscore) |
| 135 | +- Avoid duplicate reference names as they will cause build warnings |
| 136 | + |
| 137 | +## Figures and Images |
| 138 | + |
| 139 | +This section describes how to include figures and images in the documentation, supporting both HTML and PDF output formats. |
| 140 | + |
| 141 | +### Image Formats and Requirements |
| 142 | + |
| 143 | +The documentation supports two main approaches for figures: |
| 144 | + |
| 145 | +1. **Static Images** (SVG and PDF) |
| 146 | + - SVG format is required for HTML output |
| 147 | + - PDF format is required for LaTeX/PDF output |
| 148 | + - Both formats must be provided for each image |
| 149 | + - A tool is available in `./docs/utils/svg2pdf.py` to automatically convert SVG to PDF |
| 150 | + |
| 151 | +2. **PlantUML Diagrams** |
| 152 | + - All architecture, component, or sequence diagrams must be created using PlantUML |
| 153 | + - PlantUML's official Standard Library (stdlib) may be used if required |
| 154 | + - For technical details about available libraries, refer to [PlantUML's official Standard Library Documentation](https://plantuml.com/stdlib) |
| 155 | + |
| 156 | +The approaches are mutually exclusive - use either static images OR PlantUML diagrams for a given figure. |
| 157 | + |
| 158 | +### File Organization for Images |
| 159 | + |
| 160 | +Images must be organized in specific directories based on their format: |
| 161 | + |
| 162 | +- **SVG images**: Store in `./docs/en/images/svg/` |
| 163 | +- **PDF images**: Store in `./docs/en/images/pdf/` |
| 164 | +- **PlantUML diagrams**: Store source files in `./docs/en/plantuml/` with `.puml` extension |
| 165 | + |
| 166 | +### Adding Images to Documentation |
| 167 | + |
| 168 | +#### SVG and PDF Images |
| 169 | + |
| 170 | +For static images, use conditional directives to include the appropriate format based on the output target: |
| 171 | + |
| 172 | +```rst |
| 173 | +.. _fig_reference_name: |
| 174 | +
|
| 175 | +.. only:: format_html |
| 176 | +
|
| 177 | + .. figure:: ./images/svg/diagram-name.svg |
| 178 | + :alt: Description of the diagram |
| 179 | + :width: 100% |
| 180 | + :align: center |
| 181 | +
|
| 182 | + Caption text describing the figure. |
| 183 | +
|
| 184 | +.. only:: format_latex |
| 185 | +
|
| 186 | + .. figure:: ./images/pdf/diagram-name.pdf |
| 187 | + :alt: Description of the diagram |
| 188 | + :width: 100% |
| 189 | + :align: center |
| 190 | +
|
| 191 | + Caption text describing the figure. |
| 192 | +``` |
| 193 | + |
| 194 | +#### PlantUML Diagrams |
| 195 | + |
| 196 | +For PlantUML diagrams, use the `plantuml` directive: |
| 197 | + |
| 198 | +```rst |
| 199 | +.. _fig_reference_name: |
| 200 | +.. plantuml:: plantuml/diagram-name.puml |
| 201 | + :width: 99% |
| 202 | + :align: center |
| 203 | + :alt: Description of the diagram |
| 204 | + :caption: `Caption text describing the figure. <https://www.plantuml.com/plantuml/svg/ENCODED-URL>`_ |
| 205 | +``` |
| 206 | + |
| 207 | +Note that for PlantUML diagrams: |
| 208 | +- The `:caption:` attribute must include a link to the preview SVG on the PlantUML website |
| 209 | +- You do not need to use the `only::` directives as Sphinx will handle the output format automatically |
| 210 | + |
| 211 | +### Image Attributes |
| 212 | + |
| 213 | +When working with figures, understand the difference between these key attributes: |
| 214 | + |
| 215 | +- **:figwidth:** Controls the width of the entire figure block, including the caption and any padding. It defines how much horizontal space the figure occupies in the document layout. |
| 216 | + |
| 217 | +- **:width:** Controls only the width of the image itself, not the entire figure block. Use this when you need to resize just the image while allowing the caption to potentially be wider. |
| 218 | + |
| 219 | +Other useful figure attributes: |
| 220 | +- **:height:** Controls the height of the image |
| 221 | +- **:scale:** Scales the image (e.g., `:scale: 50%`) |
| 222 | +- **:alt:** Provides alternative text for accessibility (REQUIRED) |
| 223 | +- **:align:** Specifies the alignment of the figure (typically `center`) |
| 224 | + |
| 225 | +### Cross-Referencing Figures |
| 226 | + |
| 227 | +When a figure has a label defined, you can reference it from anywhere in the documentation: |
| 228 | + |
| 229 | +```rst |
| 230 | +As shown in :ref:`fig_reference_name`, the components interact through... |
| 231 | +``` |
| 232 | + |
| 233 | +This will create a link to the figure with the caption text as the link text. |
| 234 | + |
| 235 | +## Tables |
| 236 | + |
| 237 | +Use the `list-table` directive for tables: |
| 238 | + |
| 239 | +```rst |
| 240 | +.. _table_reference_name: |
| 241 | +.. list-table:: Table Title |
| 242 | + :widths: 20 60 20 |
| 243 | + :header-rows: 1 |
| 244 | +
|
| 245 | + * - **Column 1 Header** |
| 246 | + - **Column 2 Header** |
| 247 | + - **Column 3 Header** |
| 248 | + * - Cell 1 |
| 249 | + - Cell 2 |
| 250 | + - Cell 3 |
| 251 | +``` |
| 252 | + |
| 253 | +Parameters: |
| 254 | +- `:widths:` - relative widths of each column |
| 255 | +- `:header-rows:` - number of header rows (usually 1) |
| 256 | + |
| 257 | +### Table Requirements |
| 258 | + |
| 259 | +- The `list-table` directive must be used for all tables (not grid tables or simple tables) |
| 260 | +- Each table should have a label for cross-referencing (e.g., `.. _table_name:`). Use the prefix `_table_` followed by the reference table name |
| 261 | +- Each table should have a title |
| 262 | +- The following attributes are required: |
| 263 | + - `:widths:` - relative widths of each column (must match the number of columns) |
| 264 | + - `:header-rows:` - number of header rows (usually 1) |
| 265 | +- Headers should be in bold format using double asterisks (`**Header Text**`) |
| 266 | + |
| 267 | +### Row and Cell Formatting |
| 268 | + |
| 269 | +- Each row begins with a `*` character |
| 270 | +- Each cell within a row begins with a `-` character |
| 271 | +- Cells can contain multiple paragraphs, lists, or other block elements |
| 272 | +- For multi-line content in a cell, ensure proper indentation: |
| 273 | + |
| 274 | +```rst |
| 275 | +* - Cell 1 |
| 276 | + - This cell has |
| 277 | + multiple lines |
| 278 | + of content |
| 279 | + - Cell 3 |
| 280 | +``` |
| 281 | + |
| 282 | +### Cross-Referencing Tables |
| 283 | + |
| 284 | +When a table has a label defined, you can reference it from anywhere in the documentation: |
| 285 | + |
| 286 | +```rst |
| 287 | +As shown in :ref:`table_reference_name`, the parameters include... |
| 288 | +``` |
| 289 | + |
| 290 | +This will create a link to the table with the table title as the link text. For more specific references, you can refer to a table with custom text: |
| 291 | + |
| 292 | +```rst |
| 293 | +See the :ref:`Table of Credential Offer parameters <table_reference_name>`. |
| 294 | +``` |
| 295 | + |
| 296 | +## Non-Normative Examples |
| 297 | + |
| 298 | +When providing non-normative examples: |
| 299 | + |
| 300 | +1. Clearly label them as non-normative in the text |
| 301 | +2. Store examples in separate files when possible |
| 302 | + |
| 303 | +### Inline Code Examples |
| 304 | + |
| 305 | +For inline code blocks, use: |
| 306 | + |
| 307 | +```rst |
| 308 | +.. code-block:: http |
| 309 | +
|
| 310 | + GET /authorize?client_id=123&request_uri=urn%3Aietf HTTP/1.1 |
| 311 | + Host: example.org |
| 312 | +``` |
| 313 | + |
| 314 | +Specify the appropriate language for syntax highlighting. |
| 315 | + |
| 316 | +### External Code Files |
| 317 | + |
| 318 | +For larger code examples, store them in separate files (under `examples/` directory) and include them using `literalinclude`: |
| 319 | + |
| 320 | +```rst |
| 321 | +.. literalinclude:: ../../examples/request-object-header.json |
| 322 | + :language: JSON |
| 323 | +``` |
| 324 | + |
| 325 | +Label non-normative examples explicitly in the surrounding text. |
| 326 | + |
| 327 | +## Notes and Warnings |
| 328 | + |
| 329 | +Use note and warning directives to highlight important information: |
| 330 | + |
| 331 | +```rst |
| 332 | +.. note:: |
| 333 | + This is a note providing additional information. |
| 334 | +
|
| 335 | +.. warning:: |
| 336 | + This is a warning about potential issues. |
| 337 | +``` |
| 338 | + |
| 339 | +Notes and warnings should be indented with 2 spaces. |
| 340 | + |
0 commit comments