Documentation Convention¶
In public documentation, we strive to adhere to consistent principles to maintain a coherent structure for describing our products. Work on the convention is still ongoing.
Check before publishing¶
Documentation is published automatically when merged into the main
branch. Therefore, before merging a pull request, please check locally that
- all links work
- all images/icons are displayed
- the documentation is easy to read
- it adheres to accepted conventions
- you like it
How to set up a local preview?
You'll need to install Material for MKDocs and some plugins:
pip install mkdocs-material
pip install mkdocs-minify-plugin
pip install mkdocs-include-markdown-plugin
After that, in the root of your repository clone, simply run
mkdocs serve
In the console you will see something like
INFO - [10:46:26] Serving on http://127.0.0.1:8000/
Links¶
External¶
New tab/window¶
Always add {:target="_blank"}
for an external link to open it in a new tab or window
Visual mark¶
Always visually mark links that lead outside the documentation site. There are two options:
Add this icon to the end of the link title
:octicons-link-external-24:
When grouping links into blocks with grid cards
you can omit the icon if you use an explicit action in the link title, such as "Open", "Download", etc.
Example
<div class="grid cards" markdown>
- :fontawesome-brands-google-play: [Get it on __Google Play__](https://play.google.com/store/apps/details?id=com.aiuta.fashionsdk.demo){:target="_blank"}
- :fontawesome-brands-shopify: [View in the __Shopify__ app store](https://shopify.aiuta.com){:target="_blank"}
</div>
Internal¶
Use root-relative links¶
This leads to the same result but is easier to maintain in the future.
Root is /docs
Custom doc
admonition¶
If you want to specifically highlight links as references to other parts of the documentation, use a custom doc
admonition that has some special style settings
Sources¶
Always provide links to sources and packages, if available, giving preference to grid cards
.
Example
<div class="grid cards" markdown>
- :fontawesome-brands-flutter: [Pub.dev package :octicons-link-external-24:](https://pub.dev/packages/aiuta_flutter){:target="_blank"}
- :fontawesome-brands-github: [Plugin sources :octicons-link-external-24:](https://github.com/aiuta-com/flutter-sdk){:target="_blank"}
</div>
Code blocks¶
Instead of comments, give preference to annotations , which can be much more detailed and contain active links, images, and instructions. Describe things in detail, keeping the code clean and free of comments. Don't forget to specify default values in the example
admonition , if applicable.
Example
``` typescript
Foo {
bar: Bar // (1)!
}
```
1. Here is annotaion with [link](#), image
{ width=50 }
!!! example ""
and default value
Foo {
bar: Bar // (1)!
}
-
Here is annotaion with link, image
and default value
Schemes¶
To describe a language-independent scheme or data model use a code block with typescript
highlighting where
- omit key constructs such as
class
,new
, etc., that are redundant for the description - avoid traling commas and semicolons, as well as colons between property definitions and opening brackets, cluttering up the scheme
- prefer
PascalCase
for types andcamelCase
for properties (1) - define collections as
List<>
andMap<>
- denote enumerated / sealed types with
|
, combined with tabs for their schemes - indicate optional fields with
| null
- indent with 2 spaces
- except for the API, which uses
snake_case
Example
``` typescript
Foo {
fooProperty1: String
fooProperty2: Number | null
fooProperty3: Bar1 | Bar2 | null
fooEmbeddedeType {
fooEmbeddedeTypeProperty1: String
}
}
```
=== "Bar1"
``` typescript
Bar1 {
bar1Property1: List<Bool>
}
```
=== "Bar2"
``` typescript
Bar2 {
bar2Property1: Map<String, Bool>
}
```
Foo {
fooProperty1: String
fooProperty2: Number | null
fooProperty3: Bar1 | Bar2 | null
fooEmbeddedeType {
fooEmbeddedeTypeProperty1: String
}
}
Bar1 {
bar1Property1: List<Bool>
}
Bar2 {
bar2Property1: Map<String, Bool>
}
Templates¶
If several pages of your documentation contain identical sections regarding repetitive reminders, a list of some questions, or system requirements, please create templates and include them with the include-markdown
Example
%
instead of #
. Careful, it works even inside code blocks.
{# include-markdown "sdk/templates/flutter/requirements.md" %}
sdk: >=3.1.0 <4.0.0
flutter: >= 3.19.6
Appearance¶
Keep documentation clean, uncluttered, divided into sections, use visual indicators to draw attention to specific areas (icons, admonitions, grid cards mentioned earlier).
Dark theme¶
Let's respect people who prefer dark themes
- provide a contrasting alternative for monochrome images that cannot be colored, add
#only-light
or#only-dark
at the end of the resource path - define a contrasting background with
stylesheets/aiuta.css
for anything that has no alternative in the dark version
Example
<!-- good in both themes -->
:material-format-color-text:{ .cl-aiuta }
{ width=12 }
{ width=12 }
{ width=12 }
{ width=12 }
<!-- bad in a dark theme -->
:material-format-color-text:{ .cl-selection-background }
{ width=12 }
{ width=12 }
.cl-aiuta {
color: #4000FF;
}
/* Light background for dark colors to contrast */
.cl-primary,
.cl-aiuta {
background-color: #FFFFFF;
border-radius: 6px;
}
Swich docs to a dark theme using / toggle in the header to see the difference
Custom icons¶
If you need a special icon, you couldn't find a suitable one among the huge number available icons , and want to export yours from Figma and place it in the overrides/.icons
directory, please edit the exported svg
file manually, replacing the fill color (usually white
or black
for icons) with the currentColor
to match current typeface color.
Example
<svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="29" height="29" rx="4" fill="white"/>
</svg>
<svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="29" height="29" rx="4" fill="currentColor"/>
</svg>
In the current version of Figma, you can set the currentColor
as a value but it will unfortunately be replaced with some explicit color, probaly #CCCCCC
How to use custom icons?
Custom icons, which are located in the overrides/.icons
directory, will be available to use by putting the valid path between two colons, and replacing /
with -
Example
:aiuta-logo: :aiuta-favicon:
Common sense¶
Use it.