The goal of this folder is for any community member to clone these docs, make the
changes, check if they are valid, and contribute to the project.
## The Fastest Way to Contribute
There are two steps to updating the Chef InSpec documentation:
1. Update the documentation in the inspec/inspec repository.
1. Update the InSpec repository module in chef-web-docs
### Update Content in `inspec/inspec`
The fastest way to change the documentation is to edit a page on the
GitHub website using the GitHub UI.
To perform edits using the GitHub UI, click on the `[edit on GitHub]` link at
the top of the page that you want to edit. The link takes you to that topic's GitHub
page. In GitHub, click on the pencil icon and make your changes. You can preview
how they'll look right on the page ("Preview Changes" tab).
We also require contributors to include their [DCO signoff](https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco)
in the comment section of every pull request, except for obvious fixes. You can
add your DCO signoff to the comments by including `Signed-off-by:`, followed by
your name and email address, like this:
`Signed-off-by: Julia Child <juliachild@chef.io>`
See our [blog post](https://blog.chef.io/introducing-developer-certificate-of-origin/)
for more information about the DCO and why we require it.
After you've added your DCO signoff, add a comment about your proposed change,
then click on the "Propose file change" button at the bottom of the page and
confirm your pull request. The CI system will do some checks and add a comment
to your PR with the results.
The Chef documentation team can normally merge pull requests within seven days.
We'll fix build errors before we merge, so you don't have to
worry about passing all the CI checks, but it might add an extra
few days. The important part is submitting your change.
### Update the InSpec Repository Module In `chef/chef-web-docs`
We use [Hugo modules](https://gohugo.io/hugo-modules/) and [vendoring](https://gohugo.io/hugo-modules/use-modules/#vendor-your-modules)
to build Chef's documentation from multiple repositories. The Hugo modules are
pinned to commits in each repository, and the documentation files from those
repositories and commits are vendored in `chef/chef-web-docs`. When the documentation
is updated in a repository, those changes won't appear in docs.chef.io until the
Hugo modules are updated to the new commit and then vendored files are updated.
This can be useful if you want to update documentation in `inspec/inspec`, but
don't want it to appear on docs.chef.io until a later date.
To update the Hugo module for documentation in `inspec/inspec`:
1. Make sure your documentation changes are merged into master in `inspec/inspec`.
1. Contact your friendly local Docs Team who will update the InSpec Hugo module for you.
Or, for the adventurous:
1. Make sure your documentation changes are merged into master in `inspec/inspec`.
This will updated the InSpec vendored files in `chef-web-docs/_vendor/github.com/inspec/inspec/www`,
and update the commits in the go.mod and go.sum files in chef-web-docs.
## Local Development Environment
We use [Hugo](https://gohugo.io/), [Go](https://golang.org/), and[NPM](https://www.npmjs.com/)
to build the Chef Documentation website. You will need Hugo 0.61 or higher
installed and running to build and view our documentation properly.
To install Hugo, NPM, and Go on Windows and macOS:
- On macOS run: `brew install hugo node go`
- On Windows run: `choco install hugo nodejs golang -y`
To install Hugo on Linux, run:
-`apt install -y build-essential`
-`snap install node --classic --channel=12`
-`snap install hugo --channel=extended`
## Hugo Theme
We use a git submodule to grab the Hugo theme from the `chef/chef-web-docs` repository.
## Preview Workstation Documentation
There are three ways to preview the documentation in `inspec`:
- submit a PR
-`make serve`
- preview content from `chef/chef-web-docs`
### Submit a PR
When you submit a PR to `inspec/inspec`, Netlify will build the documentation
and add a notification to the GitHub pull request page. You can review your
documentation changes as they would appear on docs.chef.io.
### make serve
`make serve` will preview the documentation that only exists in `inspec/inspec/www`.
This also shows a preview page that includes page metadata which can be useful
for changing where a page exists in the left navigation menu.
To build the docs and preview locally:
- Run `make serve`
- go to http://localhost:1313
The landing page shows navigation menu metadata and the left navigation menu
shows the menu weight for each page. You can use this information to add,
remove, or reorganize Workstation documentation in the menu. None of this will
appear on the [Chef Documentation](https://docs.chef.io) site when the workstation
content is updated.
While the Hugo server is running, any changes you make to content
in the `docs/content` directory will be automatically compiled and updated in the
browser.
#### Clean Your Local Environment
To clean your local development environment:
##### `make clean`
Deletes the sass files, javascript, and fonts in `themes/docs-new`. These will be rebuilt the next time you run `make serve`.
##### `make clean_all`
Deletes the node modules used to build this site in addition to `make clean` described above. These will be reinstalled the next time you run `make serve`.
##### `make reset_chef_web_docs`
Deletes all changes to the chef-web-docs submodule. Changes to chef-web-docs must be made in the chef/chef-web-docs repo and cannot be made from any other repository. Use `make reset_chef_web_docs` to restore the submodule to its initial state.
### Preview Content from chef/chef-web-docs
You can run the Hugo server locally from `chef/chef-web-docs` and direct Hugo to
preview content from your local copy of `inspec/inspec` instead of from the
GitHub repo. This allows you to live reload documentation in `inspec/inspec` and
see how it would look in https://docs.chef.io.
See the README in `chef/chef-web-docs` for instructions.
Also, see the [Hugo documentation](https://gohugo.io/hugo-modules/use-modules/#make-and-test-changes-in-a-module)
for previewing local changes to a module.
## Manage the chef-web-docs Git Submodule
We build previews on Netlify by adding `chef/chef-web-docs` as a Git submodule
in `docs/chef-web-docs`.
To get the commit that the chef-web-docs submodule is set to, run: