|
1 | | -# Contributing guidelines |
| 1 | +# Contributing Guidelines |
2 | 2 |
|
3 | | -The following is a set of guidelines for community contributions to this |
4 | | -project. We really appreciate your desire to contribute! |
| 3 | +The following is a set of guidelines for contributing to this project. We really appreciate that you are considering contributing! |
5 | 4 |
|
6 | | -If you are an F5 employee, see the following additional guidance [For F5 Employees](./F5-NGINX-team-notes.md). |
| 5 | +## Setup |
7 | 6 |
|
8 | | -## Table of contents |
| 7 | +You will need to install Hugo _or_ Docker to build and preview docs in your local development environment. |
| 8 | +Refer to the [Hugo installation instructions](https://gohugo.io/getting-started/installing/) for more information. |
9 | 9 |
|
10 | | -- [Report a Bug](#report-a-bug) |
11 | | -- [Suggest a Feature or Enhancement](#suggest-a-feature-or-enhancement) |
12 | | -- [Open a Discussion](#open-a-discussion) |
13 | | -- [Submit a Pull Request](#submit-a-pull-request) |
14 | | - - Review our [Git style guide](#git-style-guide) |
15 | | - - Review our Documentation [style guide](./templates/style-guide.md) |
16 | | - - Review our [Contributing guidelines for writers](./CONTRIBUTING_DOCS.md) |
17 | | -- [Issue Lifecycle](#issue-lifecycle) |
18 | | -- [Content edited elsewhere](#content-edited-elsewhere) |
19 | | -- [F5 Contributor License Agreement (CLA)](#f5-contributor-license-agreement) |
| 10 | +**NOTE**: We are currently running [Hugo v0.134.2](https://github.com/gohugoio/hugo/releases/tag/v0.134.2) in production. |
20 | 11 |
|
21 | | -## Report a bug |
22 | 12 |
|
23 | | -To report a bug, open an issue on GitHub with the label `bug` using the |
24 | | -available bug report issue template. Before reporting a bug, make sure the |
25 | | -issue has not already been reported. |
| 13 | +Although not a strict requirement, markdown-link-check is also used in documentation development. |
26 | 14 |
|
27 | | -## Suggest a feature or enhancement |
| 15 | +If you have [Docker](https://www.docker.com/get-started/) installed, there are fallbacks for all requirements in the [Makefile](Makefile), meaning you don't need to install them. |
28 | 16 |
|
29 | | -To suggest a feature or enhancement, open an issue on GitHub with the label |
30 | | -`feature` or `enhancement` using the available feature request issue template. |
31 | | -Please ensure the feature or enhancement has not already been suggested. |
| 17 | +- [Installing Hugo](https://gohugo.io/getting-started/installing/) |
| 18 | +- [Installing markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#installation) |
| 19 | +- [Installing markdown-link-check](https://github.com/tcort/markdown-link-check?tab=readme-ov-file#installation). |
32 | 20 |
|
33 | | -## Open a Discussion |
| 21 | +The configuration files are as follows: |
34 | 22 |
|
35 | | -If you want to start a conversation with the community and maintainers, |
36 | | -we encourage you to use |
37 | | -[GitHub Discussions](https://github.com/nginx/documentation/discussions). |
| 23 | +- *Hugo*: `config/default/config.toml` |
| 24 | +- *markdownlint-cli*: `.markdownlint.json` |
| 25 | +- *markdown-link-check* `md-linkcheck-config.json` |
38 | 26 |
|
39 | | -## Submit a Pull Request |
| 27 | +## Local Docs Development |
40 | 28 |
|
41 | | -To contribute to F5 NGINX documentation, follow these steps: |
| 29 | +To build the documentation locally, use the `make` command in the documentation folder with these targets: |
42 | 30 |
|
43 | | -- Fork the NGINX repository |
44 | | -- Create a branch |
45 | | -- Implement your changes in your branch |
46 | | -- Submit a pull request (PR) when your changes are ready for review |
| 31 | +```text |
| 32 | +make docs - Builds the documentation. |
| 33 | +make watch - Runs a Hugo server to automatically preview changes on a local browser. Use this if you want to preview |
| 34 | + the documentation locally before submitting a PR. |
| 35 | +make drafts - Runs a Hugo server, and displays documentation marked as drafts on a local browser. By default, drafts |
| 36 | + are not displayed. |
| 37 | +make hugo-get - Updates the go module file with the latest version of the theme. |
| 38 | +make hugo-tidy - Removes unnecessary dependencies from the go module file. |
| 39 | +make hugo-update - Runs the hugo-get and hugo-tidy targets in sequence. |
| 40 | +make lint-markdown - Runs [markdownlint](https://github.com/DavidAnson/markdownlint) on the content folder. |
| 41 | +make link-check - Runs [markdown-link-check](https://github.com/tcort/markdown-link-check) on all Markdown files. Requires a running instance of Docker. |
| 42 | +make clean - Removes the local `public` directory, which is the default output path used by Hugo. |
| 43 | +``` |
47 | 44 |
|
48 | | -Alternatively, you're welcome to suggest improvements to highlight problems with |
49 | | -our documentation as described in our [support](./SUPPORT.md) page. |
| 45 | +## Add new documentation |
50 | 46 |
|
51 | | -### Git style guide |
| 47 | +We provide template files for different types of documentation. The templates, including instructions to use them and examples, are located in the [templates](templates) directory. |
52 | 48 |
|
53 | | -- Keep a clean, concise and meaningful Git commit history on your branch, rebasing locally and squashing before you submit a PR |
54 | | -- Follow the guidelines of writing a good commit message as described here <https://chris.beams.io/posts/git-commit/> |
55 | | - and summarized in the next few points: |
| 49 | +We have templates for the following types of documentation: |
| 50 | +- Concept |
| 51 | +- Getting started |
| 52 | +- How-to guide |
| 53 | +- Installation guide |
| 54 | +- Reference |
| 55 | +- Release notes |
| 56 | +- Tutorial |
56 | 57 |
|
57 | | - - In the subject line, use the present tense ("Add feature" not "Added feature") |
58 | | - - In the subject line, use the imperative mood ("Move cursor to..." not "Moves cursor to...") |
59 | | - - Limit the subject line to 72 characters or less |
60 | | - - Reference issues and pull requests liberally after the subject line |
61 | | - - Add more detailed description in the body of the git message (`git commit -a` to give you more space and time in |
62 | | - your text editor to write a good message instead of `git commit -am`) |
| 58 | +## How to format docs |
63 | 59 |
|
64 | | -#### Branch protection rules |
| 60 | +### Basic markdown formatting |
65 | 61 |
|
66 | | -This repository has the following branch protection rules in place: |
| 62 | +There are multiple ways to format text: for consistency and clarity, these are our conventions: |
67 | 63 |
|
68 | | -- **Pushing branches that contain the "internal/" prefix is not allowed.** This ensures internal development branches are not accidentally or purposefully pushed to this repo. |
69 | | -- **Two approvers are required for all merges to main and release branches.** This ensures all code that is approved for release to production is appropriately reviewed. This rule applies to all branches with `*release*` in the branch name. |
70 | | -- **Only NGINX DocOps Team members can create release branches.** This ensures the docs team is aware of all branches supporting specific product releases. This rule applies to all branches with `*release*` in the branch name. |
71 | | -- **Pushes (force or otherwise) directly to main or release branches is not allowed.** Release branches serve as "main" for the release they are associated with. Restricting pushes directly to main and release branches ensures all content changes are reviewed and approved. This rule applies to all branches with `*release*` in the branch name and to "main". |
| 64 | +- Bold: Two asterisks on each side - `**Bolded text**`. |
| 65 | +- Italic: One underscore on each side - `_Italicized text_`. |
| 66 | +- Unordered lists: One dash - `- Unordered list item`. |
| 67 | +- Ordered lists: The 1 character followed by a stop - `1. Ordered list item`. |
72 | 68 |
|
73 | | -### Documentation style guide |
| 69 | +> **Note**: The ordered notation automatically enumerates lists when built by Hugo. |
| 70 | +Close every section with a horizontal line by using three dashes: `---`. |
74 | 71 |
|
75 | | -For detailed guidance, see our documentation [style guide](./templates/style-guide.md). |
| 72 | +### How to format internal links |
76 | 73 |
|
77 | | -## Issue lifecycle |
| 74 | +Internal links should use Hugo [ref and relref shortcodes](https://gohugo.io/content-management/cross-references/). |
78 | 75 |
|
79 | | -To ensure a balance between work carried out by the NGINX team while encouraging community involvement on this project, we use the following |
80 | | -issue lifecycle: |
| 76 | +- Although file extensions are optional for Hugo, we include them as best practice for page anchors. |
| 77 | +- Relative paths are preferred, but just the filename is permissible. |
| 78 | +- Paths without a leading forward slash (`/`) are first resolved relative to the current page, then the remainder of the website. |
81 | 79 |
|
82 | | -- A new issue is created by a community member |
83 | | -- An owner on the NGINX team is assigned to the issue; this owner shepherds the issue through the subsequent stages in the issue lifecycle |
84 | | -- The owner assigns one or more [labels](https://github.com/nginxinc/oss-docs/issues/labels) to the issue |
85 | | -- The owner, in collaboration with the community member, determines what milestone to attach to an issue. They may be milestones correspond to product releases |
| 80 | +Here are two examples: |
86 | 81 |
|
87 | | -## Additional NGINX documentation |
| 82 | +```md |
| 83 | +To install <software>, refer to the [installation instructions]({{< ref "install.md" >}}). |
| 84 | +To install <integation>, refer to the [integration instructions]({{< relref "/integration/thing.md#section" >}}). |
| 85 | +``` |
88 | 86 |
|
89 | | -This repository does not include all of the source content for the NGINX documentation. Other relevant repositories include: |
| 87 | +### How to add images |
90 | 88 |
|
91 | | -- [NGINX Open Source](https://github.com/nginx/nginx) - source for [NGINX changelog](https://nginx.org/en/CHANGES) |
92 | | -- [nginx.org](https://github.com/nginx/nginx.org) - source for https://nginx.org |
93 | | -- [NGINX Unit](https://github.com/nginx/unit) - source for https://unit.nginx.org |
94 | | -- [NGINX Ingress Controller](https://github.com/nginxinc/kubernetes-ingress/) - source for https://docs.nginx.com/nginx-ingress-controller |
95 | | -- [NGINX Agent](https://github.com/nginx/agent) - source for https://docs.nginx.com/nginx-agent |
| 89 | +Use the `img` [shortcode](#using-hugo-shortcodes) to add images into your documentation. |
96 | 90 |
|
97 | | -In those repositories, you can find documentation source code in the `docs` or `site` subdirectories. |
| 91 | +1. Add the image to the `/static/img` directory. |
| 92 | +1. Add the `img` shortcode: |
| 93 | + `{{< img src="<img-file.png>" alt="<Alternative text>">}}` |
| 94 | + - **Alt text is required, and must describe in detail the content of the image.** |
| 95 | + - **Do not include a forward slash at the beginning of the file path.** |
| 96 | + - This will break the image when it's rendered: read about the [Hugo relURL Function](https://gohugo.io/functions/relurl/#input-begins-with-a-slash) to learn more. |
98 | 97 |
|
99 | | -## F5 Contributor License Agreement |
| 98 | +> **Note**: The `img` shortcode accepts all of the same parameters as the Hugo [figure shortcode](https://gohugo.io/content-management/shortcodes/#figure). |
100 | 99 |
|
101 | | -F5 requires all external contributors to agree to the terms of the F5 CLA (available [here](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md)) before any of their changes can be incorporated into an F5 Open Source repository. |
| 100 | +> **Important**: We have strict guidelines regarding the use of images in our documentation. Make sure that you keep the number of images to a minimum and that they are relevant to the content. Review the guidelines in our [style guide](/templates/style-guide.md#guidelines-for-screenshots). |
102 | 101 |
|
103 | | -If you have not yet agreed to the F5 CLA terms and submit a PR to this repository, a bot will prompt you to view and agree to the F5 CLA. You will have to agree to the F5 CLA terms through a comment in the PR before any of your changes can be merged. Your agreement signature will be safely stored by F5 and no longer be required in future PRs. |
| 102 | +### How to use Hugo shortcodes |
| 103 | + |
| 104 | +[Hugo shortcodes](https://github.com/nginxinc/nginx-hugo-theme/tree/main/layouts/shortcodes) are used to format callouts, add images, and reuse content across different pages. |
| 105 | + |
| 106 | +For example, to use the `note` callout: |
| 107 | + |
| 108 | +```md |
| 109 | +{{< note >}}Provide the text of the note here.{{< /note >}} |
| 110 | +``` |
| 111 | + |
| 112 | +The callout shortcodes support multi-line blocks: |
| 113 | + |
| 114 | +```md |
| 115 | +{{< caution >}} |
| 116 | +You should probably never do this specific thing in a production environment. |
| 117 | + |
| 118 | +If you do, and things break, don't say we didn't warn you. |
| 119 | +{{< /caution >}} |
| 120 | +``` |
| 121 | + |
| 122 | +Supported callouts: |
| 123 | +- `note` |
| 124 | +- `tip` |
| 125 | +- `important` |
| 126 | +- `caution` |
| 127 | +- `warning` |
| 128 | + |
| 129 | +You can also create custom callouts using the `call-out` shortcode `{{< call-out "type" "header" "font-awesome icon >}}`. For example: |
| 130 | + |
| 131 | +```md |
| 132 | +{{<call-out "important" "JWT file required for upgrade" "fa fa-exclamation-triangle">}} |
| 133 | +``` |
| 134 | + |
| 135 | +Here are some other shortcodes: |
| 136 | + |
| 137 | +- `fa`: Inserts a Font Awesome icon |
| 138 | +- `collapse`: Make a section collapsible |
| 139 | +- `tab`: Create mutually exclusive tabbed window panes, useful for parallel instructions |
| 140 | +- `table`: Add scrollbars to wide tables for browsers with smaller viewports |
| 141 | +- `link`: Link to a file, prepending its path with the Hugo baseUrl |
| 142 | +- `openapi`: Loads an OpenAPI specification and render it as HTML using ReDoc |
| 143 | +- `include`: Include the content of a file in another file; the included file must be present in the '/content/includes/' directory |
| 144 | +- `raw-html`: Include a block of raw HTML |
| 145 | +- `readfile`: Include the content of another file in the current file, which can be in an arbitrary location. |
| 146 | +- `bootstrap-table`: formats a table using Bootstrap classes; accepts any bootstrap table classes as additional arguments, e.g. `{{< bootstrap-table "table-bordered table-hover" }}` |
| 147 | + |
| 148 | +## Linting |
| 149 | + |
| 150 | +To run the markdownlint check, run the following command, which uses the .markdownlint.yaml file to specify rules. For `<content>`, specify the path to your Markdown files: |
| 151 | + |
| 152 | +```bash |
| 153 | +markdownlint -c .markdownlint.yaml <content> |
| 154 | +``` |
| 155 | + |
| 156 | +> Note: You can run this tool on an entire directory or on an individual file. |
0 commit comments