|
1 | 1 | # Contributing to documentation |
2 | 2 |
|
3 | | -We use [MkDocs](https://www.mkdocs.org/) and [Github pages](https://pages.github.com/) for the documentation site you're reading right now. |
| 3 | +This guide walks you through contributing to this documentation site, which is powered by [MkDocs](https://www.mkdocs.org/) and [GitHub pages](https://pages.github.com/). |
4 | 4 |
|
5 | | -## Prerequisites |
| 5 | +## Step 0: Prerequisites |
6 | 6 |
|
7 | | -Before you begin, ensure you have the following installed on your system: |
| 7 | +Before you start, make sure you have the following installed on your system: |
8 | 8 |
|
9 | | -- **Python 3** - Required for MkDocs |
10 | | -- **pip** - Python package installer (usually comes with Python) |
| 9 | +### Git |
11 | 10 |
|
12 | | -Check [MkDocs' installation guide](https://www.mkdocs.org/user-guide/installation/) on how to install these dependencies. |
| 11 | +Git is required to clone the repository and manage your changes. |
13 | 12 |
|
14 | | -## How to get started |
| 13 | +You can use [Git](https://git-scm.com/install/) from a command line interface, or use GUI such as [GitHub Desktop](https://desktop.github.com/download/) (recommended). |
15 | 14 |
|
16 | | -1. Clone the `pylon-docs` repository: `git clone https://github.com/pylonmc/pylon-docs` |
17 | | -2. Install all required dependencies: `pip install -r requirements.txt` |
18 | | -3. Run the documentation website locally using `mkdocs serve` |
| 15 | +### GitHub Account |
19 | 16 |
|
20 | | -## Deploying |
| 17 | +You will need a GitHub account to fork the repository and create pull requests. |
21 | 18 |
|
22 | | -Only core members can deploy the website. |
| 19 | +If you don't have an account yet, you can [create one for free](https://github.com/signup). |
23 | 20 |
|
24 | | -1. Clone the `pylonmc.github.io` repository: `git clone https://github.com/pylonmc/pylonmc.github.io` |
25 | | -2. Deploy the site by running **in the pylonmc.github.io repository** `mkdocs gh-deploy --config-file ../pylon-docs/mkdocs.yml --remote-branch master` |
| 21 | +### Python and pip |
26 | 22 |
|
27 | | -[comment]: <> (TODO add more detailed explanation like Slimefun has (https://github.com/Slimefun/Slimefun4/wiki/Expanding-the-Wiki)) |
| 23 | +MkDocs requires a recent version of [Python](https://www.python.org/), and the package manager [pip](https://pip.pypa.io/en/stable/installation/), to be installed on your system. |
28 | 24 |
|
| 25 | +You can check if you already have these installed from the command line (versions may be different): |
| 26 | + |
| 27 | +```bash |
| 28 | +$ python3 --version |
| 29 | +Python 3.13.3 |
| 30 | +$ pip3 --version |
| 31 | +pip 25.2 |
| 32 | +``` |
| 33 | + |
| 34 | +If Python is not installed, you can download it from the [official Python downloads page](https://www.python.org/downloads/). |
| 35 | + |
| 36 | +!!! note "For Windows users" |
| 37 | + During installation, make sure to check the box that says "Add Python to PATH" if the installer offers such an option (it's usually off by default). |
| 38 | + |
| 39 | +  |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Step 1: Forking the repository |
| 44 | + |
| 45 | +Now head over to the [pylon-docs repository](https://github.com/pylonmc/pylon-docs). |
| 46 | +Click the "Fork" button in the top-right corner of the page to create your own copy of the repository. |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Step 2: Cloning your fork |
| 53 | + |
| 54 | +You will need to clone your forked repository to your local machine to be able to preview the changes. |
| 55 | + |
| 56 | +If you use GitHub Desktop, follow [these steps](https://docs.github.com/en/desktop/adding-and-cloning-repositories/cloning-a-repository-from-github-to-github-desktop). |
| 57 | + |
| 58 | +If you use command line, go to your forked repository on GitHub and click the green "Code" button to copy the HTTPS URL. |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +Then, execute the following command: |
| 63 | + |
| 64 | +```bash |
| 65 | +git clone <REPLACE_URL_HERE> |
| 66 | +``` |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Step 3: Installing dependencies |
| 71 | + |
| 72 | +Now that you have the repository on your local machine, you need to install the required dependencies. |
| 73 | + |
| 74 | +In the `pylon-docs` directory, run: |
| 75 | + |
| 76 | +```bash |
| 77 | +pip install -r requirements.txt |
| 78 | +``` |
| 79 | + |
| 80 | +This will install MkDocs and all other necessary packages. |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## Step 4: Making your changes |
| 85 | + |
| 86 | +Now you can start editing the documentation files! |
| 87 | + |
| 88 | +!!! warning |
| 89 | + All changes you make to your fork will NOT affect the official documentation until you submit your changes via a pull request. |
| 90 | + |
| 91 | +The documentation files are written in Markdown. If you need help with the syntax, you can consult [Mastering Markdown](https://guides.github.com/features/mastering-markdown/) or review [the Markdown file for this page](https://github.com/pylonmc/pylon-docs/blob/main/docs/en/contributing/contributing-to-docs.md?plain=1). |
| 92 | + |
| 93 | +### 4.1 Understanding the documentation structure |
| 94 | + |
| 95 | +The documentation is organized by language in the `docs/` directory: |
| 96 | + |
| 97 | +```text |
| 98 | +docs/ |
| 99 | +├── en/ # English documentation |
| 100 | +├── zh-CN/ # Simplified Chinese documentation |
| 101 | +└── ... # Other languages |
| 102 | +``` |
| 103 | + |
| 104 | +For English documentation, all pages are located in `docs/en/`. The content is organized into different sections and subdirectories. |
| 105 | + |
| 106 | +!!! danger "Important" |
| 107 | + Currently, we only accept contributions to the English documentation, as we are still actively working on the content of Pylon. Please stay tuned for future updates regarding contributions to other languages. |
| 108 | + |
| 109 | +Each section has its own directory, and images for that section should be placed in an `img/` folder within the same directory. |
| 110 | + |
| 111 | +### 4.2 Creating a new page |
| 112 | + |
| 113 | +Open your code editor in the `pylon-docs` directory and follow these steps: |
| 114 | + |
| 115 | +1. Navigate to the appropriate subdirectory in `docs/en/` (e.g., `docs/en/installation/`) |
| 116 | +2. Create a new `.md` file with a descriptive name |
| 117 | + |
| 118 | +**File naming rules:** |
| 119 | + |
| 120 | +- File names must end with `.md` |
| 121 | +- Use lowercase letters |
| 122 | +- Use hyphens `-` instead of spaces |
| 123 | +- No special characters |
| 124 | +- Examples: `installing-addons.md`, `custom-recipes.md`, `getting-started.md` |
| 125 | + |
| 126 | +Then: |
| 127 | + |
| 128 | +1. Write your content using [Markdown syntax](https://guides.github.com/features/mastering-markdown/) |
| 129 | +2. Save the file |
| 130 | +3. Preview your changes (see [Step 5](#step-5-previewing-your-changes)) |
| 131 | + |
| 132 | +### 4.3 Editing an existing page |
| 133 | + |
| 134 | +1. Open the file you want to edit in your code editor |
| 135 | +2. Make your changes |
| 136 | +3. Save the file |
| 137 | +4. Preview your changes (see [Step 5](#step-5-previewing-your-changes)) |
| 138 | + |
| 139 | +### 4.4 Adding images |
| 140 | + |
| 141 | +#### Image naming conventions |
| 142 | + |
| 143 | +- Use lowercase letters only |
| 144 | +- Use hyphens `-` instead of spaces |
| 145 | +- Use descriptive names |
| 146 | +- Use PNG format when possible |
| 147 | +- Examples: `github-fork.png`, `custom-item-example.png`, `crafting-table.png` |
| 148 | + |
| 149 | +#### Where to place images |
| 150 | + |
| 151 | +Images should be placed in an `img/` folder **in the same directory** as your markdown file. |
| 152 | + |
| 153 | +For example: |
| 154 | + |
| 155 | +- If your page is `docs/en/installation/installing-pylon.md` |
| 156 | +- Place images in `docs/en/installation/img/` |
| 157 | + |
| 158 | +If the `img/` folder doesn't exist in that directory, create it first. |
| 159 | + |
| 160 | +#### Using images in your page |
| 161 | + |
| 162 | +To embed an image in your markdown file, use the following syntax: |
| 163 | + |
| 164 | +```markdown |
| 165 | + |
| 166 | +``` |
| 167 | + |
| 168 | +**Example:** |
| 169 | + |
| 170 | +```markdown |
| 171 | + |
| 172 | +``` |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## Step 5: Previewing your changes |
| 177 | + |
| 178 | +Before submitting your changes, it's a good idea to preview them locally to make sure everything looks correct. |
| 179 | + |
| 180 | +Run the following command in the `pylon-docs` directory: |
| 181 | + |
| 182 | +```bash |
| 183 | +mkdocs serve --livereload |
| 184 | +``` |
| 185 | + |
| 186 | +This will start a local web server. Open your browser and go to [`http://127.0.0.1:8000`](http://127.0.0.1:8000) to see the documentation site with your changes. |
| 187 | + |
| 188 | +The preview will automatically update when you save changes to the files. |
| 189 | + |
| 190 | +--- |
| 191 | + |
| 192 | +## Step 6: Committing and pushing your changes |
| 193 | + |
| 194 | +Once you're happy with your changes, you need to commit and push them to your fork. |
| 195 | + |
| 196 | +If you use GitHub Desktop, follow [these steps](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop) to proceed. |
| 197 | + |
| 198 | +If you use command line, run the following commands in the `pylon-docs` directory: |
| 199 | + |
| 200 | +```bash |
| 201 | +git add . |
| 202 | +git commit -m "Your commit message describing the changes" |
| 203 | +git push |
| 204 | +``` |
| 205 | + |
| 206 | +!!! tip |
| 207 | + Write a clear and descriptive commit message that explains what you changed and why. |
| 208 | + |
| 209 | +--- |
| 210 | + |
| 211 | +## Step 7: Creating a pull request |
| 212 | + |
| 213 | +Once you pushed your changes to your fork on GitHub, you can create a pull request to submit your changes. |
| 214 | + |
| 215 | +1. Go to your forked repository on GitHub. You can always find your fork on GitHub's dashboard or your profile page. |
| 216 | +2. Click on the "Pull requests" tab. |
| 217 | + |
| 218 | +3. Click on the green "New pull request" button. |
| 219 | +4. Fill in the title and description for your pull request. |
| 220 | +5. Click "Create pull request". |
| 221 | + |
| 222 | +That's it! Your changes will be reviewed by the maintainers. If everything looks good, your contribution will be accepted. |
| 223 | + |
| 224 | +--- |
| 225 | + |
| 226 | +## Step 8: Making changes to your Pull Request |
| 227 | + |
| 228 | +If you have already submitted a pull request but need to make changes (for example, if a reviewer requested changes), you can do that easily. |
| 229 | + |
| 230 | +Just repeat [Step 4](#step-4-making-your-changes) through [Step 6](#step-6-committing-and-pushing-your-changes) to make and commit your changes. |
| 231 | + |
| 232 | +The pull request will automatically update to include your new changes until it has been merged or closed. |
| 233 | + |
| 234 | +--- |
| 235 | + |
| 236 | +**Thank you for contributing to the Pylon documentation!** |
0 commit comments