diff options
Diffstat (limited to '')
-rw-r--r-- | docs/contributing/contributing-documentation.md | 137 | ||||
-rw-r--r-- | docs/contributing/style-guide.md | 317 |
2 files changed, 454 insertions, 0 deletions
diff --git a/docs/contributing/contributing-documentation.md b/docs/contributing/contributing-documentation.md new file mode 100644 index 000000000..7cf0d820f --- /dev/null +++ b/docs/contributing/contributing-documentation.md @@ -0,0 +1,137 @@ +# Contributing to documentation + +We welcome contributions to Netdata's already extensive documentation, which we host at [docs.netdata.cloud](https://docs.netdata.cloud/) and store inside of the [main repository](https://github.com/netdata/netdata) on GitHub. + +Like all contributing to all other aspects of Netdata, we ask that anyone who wants to help with documentation read and abide by the [Contributor Convenant Code of Conduct](https://docs.netdata.cloud/code_of_conduct/) and follow the instructions outlined in our [Contributing document](../../CONTRIBUTING.md). + +We also ask you to read our [documentation style guide](style-guide.md), which, while not complete, will give you some guidance on how we write and organize our documentation. + +All our documentation uses the Markdown syntax. If you're not familiar with how it works, please read the [Markdown introduction post](https://daringfireball.net/projects/markdown/) by its creator, followed by [Mastering Markdown](https://guides.github.com/features/mastering-markdown/) guide from GitHub. + +## How contributing to the documentation works + +There are two ways to contribute to Netdata's documentation: + +1. Edit documentation [directly in GitHub](#edit-documentation-directly-on-gitHub). +2. Download the repository and [edit documentation locally](#edit-documentation-locally). + +Editing in GitHub is a simpler process and is perfect for quick edits to a single document, such as fixing a typo or clarifying a confusing sentence. + +Editing locally is more complex, as you need to download the Netdata repository and build the documentation using `mkdocs`, but allows you to better organize complex projects. By building documentation locally, you can preview your work using a local web server before you submit your PR. + +In both cases, you'll finish by submitting a pull request (PR). Once you submit your PR, GitHub will initiate a number of jobs, including a Netlify preview. You can use this preview to view the documentation site with your changes applied, which might help you catch any lingering issues. + +To continue, follow one of the paths below: + +- [Edit documentation directly in GitHub](#edit-documentation-directly-on-github) +- [Edit documentation locally](#edit-documentation-locally) + +## Edit documentation directly on GitHub + +Start editing documentation on GitHub by clicking the small pencil icon on any page on Netdata's [documentation site](https://docs.netdata.cloud/). You can find them at the top of every page. + +Clicking on this icon will take you to the associated page in the `netdata/netdata` repository. Then click the small pencil icon on any documentation file (those ending in the `.md` [Markdown] extension) in the `netdata/netdata` repository. + +![A screenshot of editing a Markdown file directly in the Netdata repository](https://user-images.githubusercontent.com/1153921/59637188-10426d00-910a-11e9-99f2-ec564d6fb7d5.png) + +If you know where a file resides in the Netdata repository already, you can skip the step of beginning on the documentation site and go directly to GitHub. + +Once you've clicked the pencil icon on GitHub, you'll see a full Markdown version of the file. Make changes as you see fit. You can use the `Preview changes` button to ensure your Markdown syntax is working properly. + +Under the `Propose file change` header, write in a descriptive title for your requested change. Beneath that, add a concise descrition of what you've changed and why you think it's important. Then, click the `Propose file change` button. + +After you've hit that button, jump down to our instructions on [pull requests and cleanup](#pull-requests-and-final-steps) for your next steps. + +!!! note + This process will create a branch directly on the `netdata/netdata` repository, which then requires manual cleanup. If you're going to make significant documentation contributions, or contribute often, we recommend the local editing process just below. + +## Edit documentation locally + +Editing documentation locally is the preferred method for complex changes, PRs that span across multiple documents, or those that change the styling or underlying functionality of the documentation. + +Here is the workflow for editing documentation locally. First, create a fork of the Netdata repository, if you don't have one already. Visit the [Netdata repository](https://github.com/netdata/netdata) and click on the `Fork` button in the upper-right corner of the window. + +![Screenshot of forking the Netdata repository](https://user-images.githubusercontent.com/1153921/59873572-25f5a380-9351-11e9-92a4-a681fe4a2ed9.png) + +GitHub will ask you where you want to clone the repository, and once finished you'll end up at the index of your forked Netdata repository. Clone your fork to your local machine: + +```bash +$ git clone https://github.com/YOUR-GITHUB-USERNAME/netdata.git +``` + +You can now jump into the directory and explore Netdata's structure for yourself. + +### Understanding the structure of Netdata's documentation + +All of Netdata's documentation is stored within the repository itself, as close as possible to the code it corresponds to. Many sub-folders contain a `README.md` file, which is then used to populate the documentation about that feature/component of Netdata. + +For example, the file at `packaging/installer/README.md` becomes `https://docs.netdata.cloud/packaging/installer/` and is our installation documentation. By co-locating it with quick-start installtion code, we ensure documentation is always tightly knit with the functions it describes. + +You might find other `.md` files within these directories. The `packaging/installer/` folder also contains `UPDATE.md` and `UNINSTALL.md`, which become `https://docs.netdata.cloud/packaging/installer/update/` and `https://docs.netdata.cloud/packaging/installer/uninstall/`, respectively. + +If the documentation you're working on has a direct correlation to some component of Netdata, place it into the correct folder and either name it `README.md` for generic documentation, or with another name for very specific instructions. + +#### The `docs` folder + +At the root of the Netdata repository is a `docs/` folder. Inside this folder we place documentation that does not have a direct relationship to a specific component of Netdata. It's where we house our [getting started guide](../GettingStarted.md), guides on [running Netdata behind Nginx](../Running-behind-nginx.md), and more. + +If the documentation you're working on doesn't have a direct relaionship to a component of Netdata, it can be placed in this `docs/` folder. + +### Make your edits + +Now that you're set up and understand where to find or create your `.md` file, you can now begin to make your edits. Just use your favorite editor and keep in mind our [style guide](style-guide.md) as you work. + +If you add a new file to the documentation, you may need to modify the `buildyaml.sh` file to ensure it's added to the site's navigation. This is true for any file added to the `docs/` folder. + +Be sure to periodically add/commit your edits so that you don't lose your work! We use version control software for a reason. + +### Build the documentation + +Building the documentation periodically gives you a glimpse into the final product, and is generally required if you're making changes to the table of contents. + +!!! attention "" + We have only tested the build process on Linux. Initial tests on OS X have been unsuccessful. Windows is fully untested at this point, but we would love to know if it works there as well! + +To build the documentation, you need `python`/`pip`, `mkdocs`, and `mkdocs-material` installed on your machine. + +Follow the [Python installation instructions](https://www.python.org/downloads/) for your machine. + +Use `pip`, which was installed alongside Python, to install `mkdocs` and `mkdocs-material`. Your operating system might force you to use `pip2` or `pip3` instead, dependin on which version of Python you have installed. + +```bash +$ pip install mkdocs mkdocs-material +``` + +??? note "Troubleshooting" + If you're having trouble with the installation of Python, `mkdocs`, or `mkdocs-material`, try looking into the `mkdocs` [installation instructions](https://squidfunk.github.io/mkdocs-material/getting-started/#installation). + +When `pip` is finished installing, navigate to the root directory of the Netdata repository and run the documentation generator script. + +```bash +$ sh docs/generator/buildhtml.sh +``` + +This process will take some time. Once finished, the built documentation site will be located at `docs/generator/build/`. + +### Run a local web server to test documentation + +The best way to view the documentation site you just built is to run a simple web server from the `docs/generator/build/` directory. So, navigate there and run a Python-based web server: + +``` +$ cd docs/generator/build/ +$ python3 -m http.server 20000 +``` + +Feel free to replace the port number you want this web server to listen on (port `20000` in this case [only one higher than the agent!]). + +Open your web browser and navigate to `http://localhost:20000`. If you replaced the port earlier, change it here as well. You can now navigate through the documentation as you would on the live site! + +## Pull requests and final steps + +When you're finished with your changes, add and commit them to your fork of the Netdata repository. Head over to GitHub to create your pull request (PR). + +Once we receive your pull request (PR), we'll take time to read through it and assess it for correctness, conciseness, and overall quality. We may point to specific sections and ask for additional information or other fixes. + +## What's next + +- Read up on the Netdata documentation [style guide](style-guide.md). diff --git a/docs/contributing/style-guide.md b/docs/contributing/style-guide.md new file mode 100644 index 000000000..42c981017 --- /dev/null +++ b/docs/contributing/style-guide.md @@ -0,0 +1,317 @@ +# Netdata style guide + +This in-progress style guide establishes editorial guidelines for anyone who wants to write documentation for Netdata products. + +## Table of contents + +- [Welcome!](#welcome) +- [Goals of the Netdata style guide](#goals-of-the-Netdata-style-guide) +- [General principles](#general-principles) +- [Tone and content](#tone-and-content) +- [Language and grammar](#language-and-grammar) +- [Markdown syntax](#markdown-syntax) +- [Accessibility](#accessibility) + +## Welcome + +Proper documentation is essential to the success of any open-source project. Netdata is no different. The health of our monitoring agent, and the community it's created, depends on this effort. + +We’re here to make developers, sysadmins, and DevOps engineers better at their jobs, after all! + +We welcome contributions to Netdata's documentation. Begin with the [contributing to documentation guide](contributing-documentation.md), followed by this style guide. + +## Goals of the Netdata style guide + +An editorial style guide establishes standards for writing and maintaining documentation. At Netdata, we focus on the following principles: + +- Consistency +- High-quality writing +- Conciseness +- Accessibility + +These principles will make documentation better for everyone who wants to use Netdata, whether they're a beginner or an expert. + +### Breaking the rules + +None of the rules described in this style guide are absolute. **We welcome rule-breaking if it creates better, more accessible documentation.** + +But be aware that Netdata staff or community members may ask you to justify your rule-breaking during the PR review process. + +## General principles + +Yes, this style guide is pretty overwhelming! Establishing standards for a global community is never easy. + +Here's a few key points to start with. Where relevant, they link to more in-depth information about a given rule. + +**[Tone and content](#tone-and-content)**: + +- Be [conversational and friendly](#conversational-and-friendly-tone). +- Write [concisely](#write-concisely). +- Don't use words like **here** when [creating hyperlinks](#use-informational-hyperlinks). +- Don't mention [future releases or features](#mentioning-future-releases-or-features) in documentation. + +**[Language and grammar](#language-and-grammar)**: + +- [Capitalize words](#capitalization) at the beginning of sentences, for proper nouns, and at the beginning of document titles and section headers. +- Use [second person](#second-person)—"you" rather than "we"—when giving instructions. +- Use [active voice](#active-voice) to make clear who or what is performing an action. +- Always employ an [Oxford comma](#oxford-comma) on lists. + +**[Markdown syntax](#markdown-syntax)**: + +- [Reference UI elements](#references-to-ui-elements) with bold text. +- Use our [built-in syntax highlighter](#language-specific-syntax-highlighting-in-code-blocks) to improve the readability and usefulness of code blocks. + +**[Accessibility](#accessibility)**: + +- Include [alt tags on images](#images). + +--- + +## Tone and content + +Netdata's documentation should be conversational, concise, and informational, without feeling formal. This isn't a textbook. It's a repository of information that should (on occasion!) encourage and excite its readers. + +By following a few principles on tone and content we'll ensure more readers from every background and skill level will learn as much as possible about Netdata's capabilities. + +### Conversational and friendly tone + +Netdata's documentation should be conversational and friendly. To borrow from Google's fantastic [developer style guide](https://developers.google.com/style/tone): + +> Try to sound like a knowledgeable friend who understands what the developer wants to do. + +Feel free to let some of your personality show! Documentation can be highly professional without being dry, formal, or overly instructive. + +### Write concisely + +You should always try to use as few words as possible to explain a particular feature, configuration, or process. Conciseness leads to more accurate and understandable writing. + +### Use informational hyperlinks + +Hyperlinks should clearly state its destination. Don't use words like "here" to describe where a link will take your reader. + +``` +# Not recommended +To install Netdata, click [here](https://docs.netdata.cloud/packaging/installer/). + +# Recommended +To install Netdata, read our [installation instructions](https://docs.netdata.cloud/packaging/installer/). +``` + +In general, guides should include fewer hyperlinks to keep the reader focused on the task at hand. Documentation should include as many hyperlinks as necessary to provide meaningful context. + +### Avoid words like "easy" or "simple" + +Never assume readers of Netdata documentation are experts in Netdata's inner workings or health monitoring/performance troubleshooting in general. + +If you claim that a task is easy and the reader struggles to complete it, they'll get discouraged. + +If you perceive one option to be easier than another, be specific about how and why. For example, don't write, "Netdata's one-line installer is the easiest way to install Netdata." Instead, you might want to say, "Netdata's one-line installer requires fewer steps than manually installing from source." + +### Avoid slang, metaphors, and jargon + +A particular word, phrase, or metaphor you're familiar with might not translate well to the other cultures featured among Netdata's global community. It's recommended you avoid slang or colloquialisms in your writing. + +If you must use industry jargon, such as "white-box monitoring," in a document, be sure to define the term as clearly and concisely as you can. + +> White-box monitoring: Monitoring of a system or application based on the metrics it directly exposes, such as logs. + +Avoid emojis whenever possible for the same reasons—they can be difficult to understand immediately and don't translate well. + +### Mentioning future releases or features + +Documentation is meant to describe the product as-is, not as it will be or could be in the future. Netdata documentation generally avoids talking about future features or products, even if we know they are inevitable. + +An exception can be made for documenting beta features that are subject to change with further development. + +## Language and grammar + +Netdata's documentation should be consistent in the way it uses certain words, phrases, and grammar. The following sections will outline the preferred usage for capitalization, point of view, active voice, and more. + +### Capitalization + +In text, follow the general [English standards](https://owl.purdue.edu/owl/general_writing/mechanics/help_with_capitals.html) for capitalization. In summary: + +- Capitalize the first word of every new sentence. +- Don't use uppercase for emphasis. (Netdata is the BEST!) +- Capitalize the names of brands, software, products, and companies according to their official guidelines. (Netdata, Docker, Apache, Nginx) +- Avoid camel case (NetData) or all caps (NETDATA). + +#### Capitalization of 'Netdata' and 'netdata' + +Whenever you refer to the company Netdata, Inc., or the open-source monitoring agent the company develops, capitalize **Netdata**. + +However, if you are referring to a process, user, or group on a Linux system, you should not capitalize, as by default those are typically lowercased. In this case, you should also fence these terms in an inline code block: `` `netdata` ``. + +``` +# Not recommended +The netdata agent, which spawns the netdata process, is actively maintained by netdata, inc. + +# Recommended +The Netdata agent, which spawns the `netdata` process, is actively maintained by Netdata, Inc. +``` + +#### Capitalization of document titles and page headings + +Document titles and page headings should use sentence case. That means you should only capitalize the first word. + +If you need to use the name of a brand, software, product, and company, capitalize it according to their official guidelines. + +Also, don't put a period (`.`) or colon (`:`) at the end of a title or header. + +**Document titles**: + +| Capitalization | Not recommended | Recommended +| --- | --- | --- +| Document titles | Getting Started Guide | Getting started guide +| Page headings | Service Discovery and Auto-Detection: | Service discovery and auto-detection +| Proper nouns | Install netdata with docker | Install Netdata with Docker + +### Second person + +When writing documentation, you should use the second person ("you") to give instructions. When using the second person, you give the impression that you're personally leading your reader through the steps or tips in question. + +See how that works? It's a core part of making Netdata's documentation feel welcoming to all. + +Avoid using "we," "I," "let's," and "us" in documentation whenever possible. + +The "you" pronoun can also be implied, depending on your sentence structure. + +``` +# Not recommended +To install Netdata, we should try the one-line installer... + +# Recommended +To install Netdata, you should try the one-line installer... + +# Recommended, implied "you" +To install Netdata, try the one-line installer... +``` + +### Active voice + +Use active voice instead of passive voice, because active voice is more concise and easier to understand. + +When using voice, the subject of the sentence is performing the action. In passive voice, the subject is being acted upon. A famous example of passive voice is the phrase "mistakes were made." + +``` +# Not recommended (passive) +When an alarm is triggered by a metric, a notification is sent by Netdata... + +# Recommended (active) +When a metric triggers an alarm, Netdata sends a notification... +``` + +### Standard American spelling + +While the Netdata team is mostly *not* American, we still aspire to use American spelling whenever possible, as it is more commonly used within the monitoring industry. + +### Clause order + +If you want to instruct your reader to take some action in a particular circumstance, such as optional steps, the beginning of the sentence should indicate that circumstance. + +``` +# Not recommended +Read the reference guide if you'd like to learn more about custom dashboards. + +# Recommended +If you'd like to learn more about custom dashboards, read the reference guide. +``` + +By placing the circumstance at the beginning of the sentence, those who don't want to follow can stop reading and move on. Those who *do* want to read it are less likely to skip over the sentence. + +### Oxford comma + +The Oxford comma is the comma used after the second-to-last item in a list of three or more items. It appears just before "and" or "or." + +``` +# Not recommended +Netdata can monitor RAM, disk I/O, MySQL queries per second and lm-sensors. + +# Recommended +Netdata can monitor RAM, disk I/O, MySQL queries per second, and lm-sensors. +``` + +## Markdown syntax + +The Netdata documentation uses the Markdown syntax for styling and formatting. If you're not familiar with how it works, please read the [Markdown introduction post](https://daringfireball.net/projects/markdown/) by its creator, followed by [Mastering Markdown](https://guides.github.com/features/mastering-markdown/) guide from GitHub. + +We also leverage the power of the [Material theme for MkDocs](https://squidfunk.github.io/mkdocs-material/), which features several [extensions](https://squidfunk.github.io/mkdocs-material/extensions/admonition/), such as the ability to create notes, warnings, and collapsible blocks. + +You can follow the syntax specified in the above resources for the majority of documents, but the following sections specify a few particular use cases. + +### References to UI elements + +If you need to instruct your reader to click a user interface (UI) element inside of a Netdata interface, you should reference the label text of the link/button with Markdown's (`**bold text**`) tag. + +```markdown +Click on the **Sign in** button. +``` + +!!! note + Whenever possible, avoid using directional language to orient readers, because not every reader can use instructions like "look at the top-left corner" to find their way around an interface. + +``` +If you feel that you must use directional language, perhaps use an [image](#images) (with proper alt text) instead. + +We're also working to establish standards for how we refer to certain elements of the Netdata's web interface. We'll include that in this style guide as soon as it's complete. +``` + +### Language-specific syntax highlighting in code blocks + +Our documentation uses the [Highlight extension](https://facelessuser.github.io/pymdown-extensions/extensions/highlight/) for syntax highlighting. Highlight is fully compatible with [Pygments](http://pygments.org/), allowing you to highlight the syntax within code blocks in a number of interesting ways. + +For a full list of languages, see [Pygment's supported languages](http://pygments.org/languages/). Netdata documentation will use the following for the most part: `c`, `python`, `js`, `shell`, `markdown`, `bash`, `css`, `html`, and `go`. If no language is specified, the Highlight extension doesn't apply syntax highlighting. + +Include the language directly after the three backticks (```` ``` ````) that start the code block. For highlighting C code, for example: + +```` +```c +inline char *health_stock_config_dir(void) { + char buffer[FILENAME_MAX + 1]; + snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_stock_config_dir); + return config_get(CONFIG_SECTION_HEALTH, "stock health configuration directory", buffer); +} +``` +```` + +And the prettified result: + +```c +inline char *health_stock_config_dir(void) { + char buffer[FILENAME_MAX + 1]; + snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_stock_config_dir); + return config_get(CONFIG_SECTION_HEALTH, "stock health configuration directory", buffer); +} +``` + +You can also use the Highlight and [SuperFences](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/) extensions together to show line numbers or highlight specific lines. + +Display line numbers by appending `linenums="1"` after the language declaration, replacing `1` with the starting line number of your choice. Highlight lines by appending `hl_lines="2"`, replacing `2` with the line you'd like to highlight. Or, multiple lines: `hl_lines="1 2 4 12`. + +!!! note + Line numbers and highlights are not compatible with GitHub's Markdown parser, and thus will only be viewable on our [documentation site](https://docs.netdata.cloud/). They should be used sparingly and only when necessary. + +## Accessibility + +Netdata's documentation should be as accessible as possible to as many people as possible. While the rules about [tone and content](#tone-and-content) and [language and grammar](#language-and-grammar) are helpful to an extent, we also need some additional rules to improve the reading experience for all readers. + +### Images + +Images are an important component to documentation, which is why we have a few rules around their usage. + +Perhaps most importantly, don't use only images to convey instructions. Each image should be accompanied by alt text and text-based instructions to ensure that every reader can access the information in the best way for them. + +#### Alt text + +Provide alt text for every image you include in Netdata's documentation. It should summarize the intent and content of the image. + +In Markdown, use the standard image syntax, `![]()`, and place the alt text between the brackets `[]`. Here's an example using our logo: + +``` +![The Netdata logo](../../web/gui/images/netdata-logomark.svg) +``` + +#### Images of text + +Don't use images of text, code samples, or terminal output. Instead, put that text content in a code block so that all devices can render it clearly and screen readers can parse it. |