Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style guide #642

Merged
merged 10 commits into from
Dec 3, 2016
13 changes: 11 additions & 2 deletions source/guides/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@ Development Process
/process/release-process*
/process/accepting-pull-request*
/process/community-systems*
/process/documentation-guidelines*
/process/documentation-guidelines.md

Documentation Style Guide
=========================

.. toctree::
:maxdepth: 3

Introduction </process/sg_mattermost-doc-style.rst>
/process/sg_document-structure.rst
/process/sg_grammar-spelling-mechanics.rst
/process/sg_rest_markup.rst

Joining the Team
=========================
Expand All @@ -29,4 +39,3 @@ Joining the Team
/process/security*
/process/training*
/process/people-ops*

4 changes: 4 additions & 0 deletions source/process/documentation-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Documentation Conventions

**Note:** This document is in the process of being revised. See the new work-in-progress version here: <a href="sg_mattermost-doc-style.html">Mattermost Documentation Style Guide</a>.

----

The most important thing about documentation is getting it done and out to the community.

After that, we can work on upgrading the quality of documentation. The below chart summarizes the different levels of documentation and how the quality gates are applied.
Expand Down
30 changes: 30 additions & 0 deletions source/process/sg_document-structure.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
==================
Document structure
==================

Structure and organization are an important part of a document's ease of use and its understandability. Information should be organized and presented in a logical order, with similar subjects grouped together in the same section.

In most cases, a document has a title, an introductory paragraph, and one or more sections.

Try to keep only one topic in a page. Shorter topics are easier to reuse in other documents, are easier to write and edit, and are easier to translate.

Document title
==============

Use a title that accurately reflects the content of the document. People scan the table of contents looking for answers; it's often faster than using the built-in search engine.

Use title case for document titles. For more information and an example of capitalization, see :ref:`capital`.

Introductory paragraph
======================

Each page should have an introduction that acts as a short description of the document. The short description should be a single paragraph of no more than 3 sentences. Keep in mind that the description is displayed in the search results along with the page title. People read the description to help them decide if the document is the one that they want.

Document sections
=================

To make pages easier for people to quickly scan for the content that they're looking for, break your document up into logical sections. Each section should have a title, and the title should relate to the content of the section.

A section title is not required if you have only one section.

Avoid subsections. If you find that you need subsections, quite often the document is too long, or too complex, and needs to be broken up into several pages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to discussion.

I'm not sure about breaking into different pages, as it could clutter the navigation. We have typically used sub-sections, which also help when people are searching a page for a term.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two approaches to this. One is to have one large monolithic file. The other is to have a docset made up of standalone files that are used where needed via :toctree:. I suppose there are pros and cons to each approach, but I would advocate for more granular, standalone, topic-based files for all Mattermost docs, not just the style guide, for the following reasons:

  1. As a general rule, the content is easier to manage when it's broken up into standalone files with one topic per file. For example, if the MySQL config is one standalone file, it can be pulled into any number of Administration doc sets using :toctree: in Sphinx. If something changes and the MySQL instructions need updating, then the change is made in one place and that change automatically propagates to every doc set. If instead the MySQL content is copy/pasted into a dozen long pages, then you need to make sure that you catch every occurrence.
  2. Content is easier to find for end users. For example, search the docs for the term database installation (https://docs.mattermost.com/search.html?q=database+installation&check_keywords=yes&area=default) and try to figure out which one of the results has your answer. If instead there was a topic called "Installing PostgreSQL database" it would most likely show up in the search results. Furthermore, when you clicked that result, the page would open and the installation instructions would be right there. As it is, none of the search results look promising, so you end up scanning the toc and clicking around until you find something.

Having said that, it looks like a lot of open source products are going for the monolithic style these days. I suppose you can make use of the :include: directive, which would allow standalone files in the repo and a monolithic file appearing in the published docs. This would leave the options open.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JeffSchering, propose we try the open source style of monolithic with includes?

Agree on your points of being easier to search and find things, it's just the rest of our docs are monolithic, and if we're going to change it's going to be a larger project.

Maybe add a section in Doc Guidelines about how to organize within a monolith (e.g. maybe with a mini-TOC?) and how to use includes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeffSchering not sure your thoughts on trying the monolith vs. separate pages? This PR seems to have a number of short and long pages broken up, did you want them still separate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the pages separate, but when built they're all included into a monolith, which is what readers will see. See sg_mattermost-doc-style.rst for the ..include:: statements.

Here's an idea of what it would look like when ouput to HTML:

image

The Document sections stuff is in sg_document-structure.rst and Grammar, spelling, mechanics is in sg_grammar-spelling-mechanics.rst.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks @JeffSchering!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually use subsections quite a lot and can find them useful.

One sample page is Account Settings where we use subheadings to refer to particular account settings.

Let me know if you'd have any thoughts on that @JeffSchering? Could there be use cases when subsections might work better?

137 changes: 137 additions & 0 deletions source/process/sg_grammar-spelling-mechanics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
================================
Grammar, spelling, and mechanics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be title cased per "Document Title" guidelines above?

================================

To maintain consistency across all Mattermost technical documentation, adhere to the guidelines here.

Language and spelling
=====================

Write documents in English. Use American spelling.

Paragraphs and sentences
========================

Paragraphs should express one idea or topic. Long paragraphs are sometimes difficult to read on screen, so try to keep them to 5 sentences or less. Short paragraphs are easier for people to scan quickly.

Try to keep sentences to 25 words or less in length. Short, single-clause sentences are often easier to understand and easier to translate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could referencing the Hemingway writing app be useful?

It's a common tool to simplify your paragraphs and sentences, which could be helpful for anyone working on docs.

Not sure if you've used the app yourself or if you've used something else before @JeffSchering


Commas
======

As a general rule, the serial comma results in greater clarity. However, there are always edge cases where a serial comma adds confusion to a sentence. Therefore, the Mattermost documentation will use the following rule for commas:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serial comma is okay, but I'm not sure about the reasoning.

It sounds that "serial comma is preferred for greater clarity -- but there are edge cases, and therefore we use the serial comma". I assume the serial comma use is preferred due to clarity, so maybe just re-write this paragraph to make it clearer?


Use the serial comma unless doing so decreases clarity and understanding of the sentence.

Preferred
The cows ran from wolves, coyotes, and mosquitoes.

Avoid
The cows ran from wolves, coyotes and mosquitoes.

Tone
====

Use a direct, impartial tone. Most readers of the documentation are looking for answers and solutions to their problems; they are not looking for entertainment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question: Following the guideline of using short sentences, should we avoid the use of semicolons in docs? Does that make sentences structurally more complicated?


Preferred
If your password is rejected, check to make sure that Caps Lock is off, and then carefully type it in again.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propose using exemplary guidelines that are short, simple and ambiguous. This one seems a little long where "Caps Lock" is ambiguous (it's not clear whether it should be capitalized, for instance)


Avoid
Failed sign in? No problem! Simply enter the correct password and we'll let you in right away.

.. _capital:

Capitalization
==============

Use title case for page titles and sentence case for section titles.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if heading and section titles should also be title case?

Or do we have a principle/guideline on why we would use sentence case instead?


Title case
Grammar, Spelling, and Mechanics

Sentence case
Language and spelling

Voice
=====

Use active voice in preference to passive voice. Active voice has the subject of a sentence doing the action. In passive voice, the subject has an action done to it. Use passive voice only when you want to emphasize the action more than the subject.

Preferred
The system opens the *Status* pane.

Avoid
The *Status* pane is opened by the system.

Person
======

Use the second person and avoid the first person.

Preferred
You can view the status in the *Status* pane.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a guideline where imperative language is preferred?

e.g. where View the status in the *Status* pane is preferred over You can view the status in the *Status* pane


Avoid
We'll view the status in the *Status* pane.

Numbers
=======

Use decimal numbers except when the number is the first word of a sentence. Use commas to make long numbers easier to read.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I wasn't clear the first time I read this what a "decimal number" was, and what was the alternative ("written number"?).

I had the read the examples multiple times and go back to the original description before I figured it out.

Maybe tweak a bit?

I think I learned the term "decimal numbers" when I was in grade school, but haven't thought of them since then...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about: "Spell out numbers when they are the first word in a sentence, otherwise use numeric digits."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!


Preferred
Three cows ran for 6 kilometers when they saw 2,300,097 mosquitoes chasing them.

Avoid
3 cows ran for six kilometers when they saw 2300097 mosquitoes chasing them.

Text highlighting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call the section "Text Formatting"

=================

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should we add an introduction sentence to this section?
  2. Should we add formatting to Highlights section to better communicate how each highlight appears?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... more work needed here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff,

============== =========================================
Text Highlight
============== =========================================
filepath monospace (directory paths, file names)
inline code monospace
code block monospace
Menu selection bold
UI selection bold (includes buttons, links, names of controls, and field names)
text entry monospace
references italic
============== =========================================

Contractions
============

As a general rule, contractions are acceptable in Mattermost documents.

Verb tense
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe group "Verb tense" with tone and voice earlier in the document?

==========

Use the present tense.

Preferred
Sharing this link lets other users view the linked message.

Avoid
Sharing this link will let other users view the linked message.

Bullet lists
============

The list items in a bullet list can be either all complete sentences or all sentence fragments. Don't mix complete sentences and sentence fragments in a single list. Remember that a complete sentence begins with an upper case letter and ends with a punctuation mark.

Numbered lists and procedures
=============================

Create numbered lists and procedure steps using arabic numerals for the top-level list and lower case alpha characters for the first nested list. For example:


1. This is the first step.
2. This is the second step.

a. This is a substep.
b. This is another substep.

3. This is the third step.
28 changes: 28 additions & 0 deletions source/process/sg_mattermost-doc-style.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
====================================
Mattermost Documentation Style Guide
====================================

This is the Mattermost style guide for documentation. It acts as a reference for writers and editors to ensure that the Mattermost documentation is consistent and clear.

.. Note::
The style guide is not intended to slow down or otherwise impede contributions, which are always welcome. No contribution will be rejected due to non-conforming style, although it might be edited.

The Mattermost documentation must be of high quality. It must be accurate and clear, and be presented with a style and tone that is appropriate for technical content. People who use Mattermost rely on the documentation to get their jobs done. We don't want to see an installation of Mattermost delayed because the documentation has an error or is difficult to understand.

.. comments

Main screen, Navigation panel, Message Details panel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er... kind of confused by this section...
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are just comments to myself. They should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff,


how to link to other documents. ie, not click here

should be no need for section breaks, ie ---------- that gets output as <br>

avoid documenting features; instead, document tasks. describe things that people want to do

Steps: Each step should describe one action. Each step should be a complete sentence.

avoid noun clusters. that is, three or more nouns in a row

Use might or can instead of may. use 'may' only when giving permission.

Users sign in to Mattermost; they do not log in.
128 changes: 128 additions & 0 deletions source/process/sg_rest_markup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
=============================
Using reStructuredText Markup
=============================

The reStructuredText specification allows for a certain degree of flexibility in markup to achieve your goals. For example, you can use any one of more than a dozen characters for section title underlines, and you have the option of using overline in addition to an underline.

However, for consistency and ease of use, the Mattermost documentation should use a single convention, despite the existence of allowable alternatives.

For more information about reStructuredText markup, see the `reStructuredText Markup Specification`_. Additional markup constructs are implemented by Sphinx, the documentation generator used by Mattermost. For information about the additional constructs, see `Sphinx Markup Constructs`_.

Use the following markup conventions in Mattermost documentation:

Page titles
===========

For page titles, use an overline and an underline. Use the = character. For example:

::

=============================
Using reStructuredText Markup
=============================

Unlike Markdown, overlines and underlines in reStructuredText must be at least as long as the title text.

Section titles
==============

If your document has more than one section, use the = character for the section title underline. For example:

::

Section titles
==============

If you do need subsections, use the the - character for the first subsection level, and the \` character for the second subsection level. For example:

::

Subsection One
--------------

Subsection Two
``````````````

Bullet lists
============

For bullet lists and sublists, use only the - character. For example:

.. code-block:: none

- list item one
- list item two
- sublist item one
- sublist item two
- list item three

Numbered lists and procedure steps
==================================

Create numbered lists and procedure steps using arabic numerals for the top-level list and lower case alpha characters for the first nested list. For example:

.. code-block:: none

1. This is item one.
2. This is item two.

a. This is nested item one.
b. This is nested item two.

3. This is item three.

Linking to other documents
==========================

Use relative links to reference other documents in the Mattermost doc set. Also, use either the :doc: or :ref: linking mechanisms that are provided by Sphinx.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section was confusing to me, could we get it to a state where we don't need to go to an external link?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff


Preferred
.. code-block:: none

:doc:`sg_mattermost-doc-style`
:ref:`target-label`

Avoid
.. code-block:: none

`Mattermost Documentation Style Guide`_

_Mattermost Documentation Style Guide: sg_mattermost-doc-style.html

For more information about how to use :doc: and :ref:, see `Inline markup`_ on the Sphinx documentation page.


.. _reStructuredText Markup Specification: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
.. _Sphinx Markup Constructs: http://www.sphinx-doc.org/en/stable/markup/index.html
.. _Inline markup: http://www.sphinx-doc.org/en/stable/markup/inline.html

Literal blocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section was also hard to follow for me. Perhaps add an intro sentence and some examples so it's more clear to someone who's learning, or coming over form markdown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff

==============

In reStructuredText markup, the double colon marks the start of a section of literal text that corresponds to the HTML <pre> tag. However, the Sphinx processor applies syntax highlighting for Python to literal blocks.

To use a literal block as originally intended in the reStructuredText specification, you must cheat a little, and use explicit code block markup with the language set to `none`. For example:

.. code-block:: none

.. code-block:: none


Menu selections
===============

To indicate a series of menu selections, avoud the menuselection role that the Sphinx processor provides.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little difficult for me to follow "Menu selections", as I think this referring to documentation about selecting menus, but it's appearing in the RST tutorial section.

My expectation is that the RST tutorial would explain how to make things bold, italic, monospace, etc. and the guideline on how menu items appear would be in a different section?

Copy link
Contributor Author

@JeffSchering JeffSchering Nov 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. The reason I have it here is because if you use the :menuselection: directive, you end up with normal text and a tiny grey right arrow between items instead of bold text with the > character between items. I don't think it's a problem to have the menu selection criteria in a couple of places, so I'll add it into the grammar-spelling-mechanics section.

It's probably worth it to review all the semantic markup elements offered by Sphinx and come up with either a blanket statement about using them or not using them, or specify those which we think should be used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff, I think for this phase of the project we can maybe stay with basic RST (just what you see when you read our docs) and we can add the more fancy stuff later?

Generally knowledge of RST is low, so what you have to start is excellent. We kind of need the 10% of RST that covers 90% of use.


Preferred
.. code-block:: none

Click **File > Open**.

This produces Click **File > Open**.

Avoid
.. code-block:: none

Click :menuselection:`File --> Open`.

This produces :menuselection:`File --> Open`