Contribute locally
Follow these steps to contribute to Elastic docs.
- Prerequisites
- Install
docs-builder
- Clone a content repository
- Build the docs
- Write the docs
- Push your changes
To write and push updates to Elastic documentation, you need the following:
- A code editor: we recommend Visual Studio Code
- Git installed on your machine: learn how here
- A GitHub account: sign up here
There are two different ways to install and run docs-builder
:
- Download, extract, and run the binary (recommended).
- Clone the repository and build the binary from source.
This guide uses the first option. If you'd like to clone the repository and build from source, learn how in the project readme.
Download and run the install script
Run this command to download and install the latest version of
docs-builder
:curl -sL https://ela.st/docs-builder-install | sh
This downloads the latest binary, makes it executable, and installs it to your user PATH. You can optionally specify a specific version to install:
DOCS_BUILDER_VERSION=0.40.0 curl -sL https://ela.st/docs-builder-install | sh
To download and install the binary file manually, refer to Releases on GitHub.
Run docs-builder from a docs folder
Use the
serve
command from any docs folder to start serving the documentation at http://localhost:3000:docs-builder serve
The path to the
docset.yml
file that you want to build can be specified with-p
.ImportantRun
docs-builder
withoutserve
to run a full build and detect errors.
To download and install the binary file manually, refer to Releases on GitHub.
If you get a Permission denied
error, make sure that you aren't trying to run a directory instead of a file. Also, grant the binary file execution permissions using chmod +x docs-builder
.
Download and run the install script
Run this command to download and install the latest version of
docs-builder
:iex (New-Object System.Net.WebClient).DownloadString('https://ela.st/docs-builder-install-win')
This downloads the latest binary, makes it executable, and installs it to your user PATH. You can optionally specify a specific version to install:
$env:DOCS_BUILDER_VERSION = '0.40.0'; iwr -useb https://ela.st/docs-builder-install.ps1 | iex
To download and install the binary file manually, refer to Releases on GitHub.
Run docs-builder from a docs folder
Use the
serve
command from any docs folder to start serving the documentation at http://localhost:3000:docs-builder serve
The path to the
docset.yml
file that you want to build can be specified with-p
.
Documentation lives in many repositories across Elastic. If you're unsure which repository to clone, you can use the "Edit this page" link on any documentation page to determine where the source file lives.
In this guide, we'll clone the docs-content
repository. The docs-content
repository is the home for narrative documentation at Elastic. Clone this repo to a directory of your choice:
git clone https://github.com/elastic/docs-content.git
We write docs in Markdown. Refer to our syntax guide for the flavor of Markdown that we support and all of our custom directives that enable you to add a little extra pizzazz to your docs.
Before pushing your changes, check that your changes build successfully.
docs-builder
The build process informs you of any critical errors or warnings. It also shows less critical issues as Hints. Make sure not to introduce any new build errors, warnings, or hints.
After you've made your changes locally:
Static-site generators like docs-builder can serve docs locally. This means you can edit the source and see the result in the browser in real time.
To serve the local copy of the documentation in your browser, follow these steps:
-
Change directory to a docs repository
For example,
docs-content
:cd docs-content
-
Run docs-builder
Run the
docs-builder
binary with theserve
command to build and serve the content set to http://localhost:3000. If necessary, specify the path to thedocset.yml
file that you want to build with-p
.For example:
docs-builder serve -p ./migration-test
docs-builder serve -p .\migration-test
-
Open the documentation in the browser
Now you should be able to view the documentation locally by navigating to http://localhost:3000.