Our Documentation roadmap outlines both our short-term and long-term goals for Snap-related documentation.
Feel free to modify any documentation topic with updated or more insightful information. If you already participate in the snap community, you don’t need additional permissions; pages are freely editable within the forum itself. Of course, feel free to ask and discuss when appropriate.
Documentation consistency is vital, which is why we’re listing some guidelines below, but don’t let this formality put you off - just start writing and editing. If something is inconsistent, we’ll fix it.
As Voltaire wrote, “Perfect is the enemy of good,” and we’d rather have inconsistent documentation we can easily fix than non-existent documentation we can’t.
One of our biggest challenges is accommodating an audience with a huge variation in experience, from beginners exploring the snap command, through snap creators experimenting with snapcraft.yaml, to experts harnessing the API and deploying snaps across thousands of IoT devices.
Consequently, we try to:
Some general tips:
We (mostly) adhere to the Ubuntu style guide. In particular:
Mostly, you don’t need to worry about the syntax. You can simply use the style toolbar in the Discourse topic editing window to mark the elements you need.
## Subheading within a document ### Subheading of a subheading
We don’t use the top-level heading (
# Heading) because the topic title in Discourse serves this purpose.
Headings and subheadings need to use sentence case, which means the first letter is typically the only one capitalised, unless the title includes names, product names or acronyms.
For a bullet list, use the following syntax:
We (mostly) adhere to the Ubuntu style guide, for example: - we use British English (en-GB): - the _ise_ suffix in preference to _ize_
And for a numbered list, precede each item with
1. (the numbering then becomes automatic, and it’s easier to insert new items):
1. This is the first item 1. This is the second 1. This is the third 1. This is a sublist
Unless a list item is particularly long (which should be avoided) and includes punctuation, don’t end the item with a full stop. If one item needs a full stop, add the full stop to other items too.
Enclose a code block with three backticks and include the type of code:
```yaml name: gimp version: '2.10.8' summary: GNU Image Manipulation Program ```
The most common code types are:
no-highlight. The last is like a miscellaneous type. It is often used to display command output.
Also, a little contentiously as it goes against the style guide, we use a command line dollar prompt (
$) to demarcate input and output in the same code block:
$ snap version snap 2.36.1 snapd 2.36.1 series 16 ubuntu 18.04 kernel 4.15.0-39-generic
Use a backtick mark inline commands and other literals. For instance, to create
For instance, to create `$SNAP_DATA`:
For links to internal files or external URLs, use the following format:
visible text is what will appear in the documentation. The
url is either the full URL of a link outside of the documentation, or the topic reference without the domain name for a page within the documentation.
To link to
https://forum.snapcraft.io/t/snapcraft-overview/8940, for example, you would use the following:
For more details, see [Snapcraft overview](/t/snapcraft-overview/8940).
The Discourse topic identifier, 8940 in the above example, is optional and can be omitted.
Discourse Markdown does not support anchor links to a position within the same page or another document.
However, you can use standard HTML within Markdown, which means we can manually add HTML anchor elements that can be linked to.
The recommended way to create anchors is using heading elements with an ID. The ID needs to have
heading-- as a prefix:
<h3 id='heading--myanchor'>Link to me</h3>
To create an anchor called
base-snap, for example, enter the following into your document:
<h3 id='heading--base-snap'>Base snaps</h3>
This can now be linked to with the following:
Use HTML sparingly as it can make the raw text difficult to read.
It’s occasionally worth highlighting important notes or warnings outside of the main body of text. These are called admonishments.
There is no current standard for admonishments with Discourse Markdown. We have hijacked Markdown’s block-quote syntax for this purpose, starting an admonishment with a
>, often followed by a symbol, and then the text itself:
The Markdown for the above is as follows:
> ⓘ **Note**: Layouts can only help _within_ a snap's environment.
An admonishment type is typically either ‘Note’ or ‘Warning’ or omitted completely.
Sometimes it’s useful to provide information to documentation editors. For that, add the comment inside a block quote that includes the icon. These will be excluded from the dedicated documentation web site, but will be visible in the forum when editing. It may look similar to this:
[quote] :construction: **NOTE TO EDITORS** :construction: This note is not visible in the dedicated documentation site. [/quote]
When a page contains a lot of extraneous information such as walkthroughs or reference tables, a foldout can be used. This will create a collapsed header which, when clicked, will expand to display all the content below it.
Foldout syntax in Discourse uses two sets of square brackets with an open and close details tag that acts as the title in the opening brackets:
[details=Manually create a network on a 10.x.x.x subnet] If you try to run `lxd init` on a system that is connected to a network with a `10.x.x.x` subnet, then the final step of the Iinit* may fail with the following error: [/details]
The above will appear as follows:
If you try to run
lxd init on a system that is connected to a network with a
10.x.x.x subnet, then the final step of the Iinit* may fail with the following error:
Most of our documentation covers command line tools, editing and developing. However, if relevant, we highly encourage the use of images. An image should be easier to understand than text, reinforce concepts being discussed in the topic, and break the monotony of words following words.
When making images:
Images can be simply dragged and dropped into the topic you’re editing, or uploaded via the toolbar icon. It can also be helpful to edit the description field of an image link after uploading:
![description of image](url)
Last updated a month ago. Help improve this document in the forum.