It is possible to simply edit the documentation with a text editor and [send PRs](#pull-requests) without using any other tooling.
[Lints](#linting-and-formatting) will be run when PRs are sent to ensure that content and code comply with our stylistic rules.
However, several tools are available to run locally to help ensure that content is [formatted](#linting-and-formatting) appropriately before committing,
as well as to [preview](#previewing-changes) your changes on a local copy of the Forgejo website.
#### Getting set up
To run the tools used in this repo you will need [NodeJS](https://nodejs.org/en/download) on your machine.
The required version will change over time, but in general it is recommended to use at least the latest LTR release.
You'll also need [PNPM](https://pnpm.io/installation). The easiest way to install it on most systems is to use the
command `corepack enable`, which is part of NodeJS. However depending on your system you may prefer to use a package manager.
Once you have Node and PNPM installed, just run `pnpm install` from the root of this repo to fetch the dependencies
and set up the Git [pre-commit hook](#pre-commit-hook).
```shell
# Install/enable PNPM
corepack enable
# Clone this repo (or your fork of it)
git clone git@codeberg.org:forgejo/docs
cd docs
# Install the dependencies
pnpm install
```
Every time you `pull` the repo or `checkout` a different branch, you should run `pnpm install` again to update the dependencies.
#### Previewing changes
```shell
pnpm run preview
```
This command will clone the [website repo](https://codeberg.org/forgejo/forgejo)
and launch a local development server. The current docs branch will be opened in the browser.
This command generates svg images from [Mermaid](https://github.com/mermaid-js/mermaid) code.
Mermaid code should be stored in `docs/_mermaid/` with their path being relative to the markdown files where the diagrams are used.
The images are generated in `docs/_mermaid/_images/` in their respective relative paths, from where they can be referenced. The mermaid generator generates .svg out of [mermaid].md files. The generated .svg get a -[n].svg postfix, more than one diagram can be described in one [mermaid].md file.