|
1 | | -Documentation contributing guide {How to edit the docs) |
2 | | -============ |
3 | | - |
4 | | -Interested in updating existing pages or writing your own page? Here you'll learn the basics on contributing to RoR's documentation. This guide assumes you're running Windows, but most steps should be valid on Linux as well. |
5 | | - |
6 | | -## Requirements |
7 | | -- A GitHub account |
8 | | -- [GitHub Desktop](https://desktop.github.com/) |
9 | | -- [Git for Windows](https://gitforwindows.org/) (Leave all installer options as the default) |
10 | | -- [Python](https://www.python.org/downloads/) (Make sure the "Add to PATH" option is selected in the installer) |
11 | | - |
12 | | -## Forking the repository |
13 | | -To begin, head over to the [docs.rigsofrods.org GitHub repository](https://github.com/RigsOfRods/docs.rigsofrods.org) and click the  button at the top right. This will create a copy of the repository on your GitHub account where your changes will be made. |
14 | | - |
15 | | -## Using GitHub Desktop |
16 | | -After installing GitHub Desktop, launch the app and sign into your GitHub account. After signing in, it'll ask you to clone a repository. Select the repository you forked earlier along with where you want the repository to be stored locally: |
17 | | - |
18 | | - |
19 | | - |
20 | | -When the cloning process is finished, it will ask how you plan on using this repository. I recommend selecting "For my own purposes" as this will prevent confusion between your fork and the main repository. |
21 | | - |
22 | | -In the toolbar, click `Repository` -> `Open in Command Prompt` This is where you'll run the commands in the following steps. |
23 | | - |
24 | | -## Installing MkDocs |
25 | | -The documentation is powered by MkDocs. it will need to be installed if you wish to be able to preview your changes in real time. Go to the [official MkDocs installation](https://www.mkdocs.org/user-guide/installation/) page and follow the steps listed there, come back here once you've reached the "Installing MkDocs" section. |
26 | | - |
27 | | -After you've successfully installed Python and pip, run the following commands one by one in the command prompt window you opened earlier: |
28 | | -``` |
29 | | -pip install mkdocs |
30 | | -pip install mkdocs-material |
31 | | -pip install mkdocs-minify-plugin |
32 | | -pip install mkdocs-git-revision-date-localized-plugin |
33 | | -``` |
34 | | - |
35 | | -These packages can also be found in the `requirements.txt` file in the root of the repository. |
36 | | - |
37 | | -Once everything is installed, you should now be able to view a local version of the docs by running `mkdocs serve`. Your command prompt window should now look like this: |
38 | | - |
39 | | - |
40 | | -The documentation should now be viewable in your browser at `http://127.0.0.1:8000/` |
41 | | - |
42 | | -The page will automatically reload when changes are made. |
43 | | - |
44 | | -## Making changes |
45 | | -In GitHub Desktop, it is **highly** recommended that you create a new branch by selecting `Branch -> New branch...` in the toolbar. This will ensure you don't make changes you didn't want to the main branch, as undoing them can be a pain without creating unnecessary commits. |
46 | | - |
47 | | -Pages are written in Markdown, the same formatting syntax used on GitHub. See [this page](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to learn the basic Markdown syntax. |
48 | | - |
49 | | -### Adding images |
50 | | -To add a new image to a page, add the image to the `source\images` folder: |
51 | | - |
52 | | - |
53 | | -Give the image a name that describes what the image is of (example for the above image: `explorer-images-folder.png`) Then reference the image in the page using this syntax: |
54 | | - ``` |
55 | | -  |
56 | | - ``` |
57 | | - |
58 | | -**Note:** It seems in recent versions of MkDocs, the `mkdocs serve` command can crash after adding an image to the folder. Just run it again if this happens to you. |
59 | | - |
60 | | -### Creating new pages |
61 | | -To create a new page, simply create a new file with the `.md` file extension in the appropriate category folder. |
62 | | - |
63 | | -Make sure you also add the page to the sidebar by editing `mkdocs.yml`, otherwise `mkdocs serve` will show a warning! |
64 | | - |
65 | | -### Linking other docs pages |
66 | | - |
67 | | -To link to other pages on the docs, use the following syntax: |
68 | | - |
69 | | -``` |
70 | | -Correct: |
71 | | -[Beginner's Guide](/gameplay/beginners-guide/) |
72 | | -Incorrect: |
73 | | -[Beginner's Guide](https://docs.rigsofrods.org/gameplay/beginners-guide/) |
74 | | -``` |
75 | | - |
76 | | -## Making a pull request |
77 | | -Once you're finished editing, your GitHub Desktop app will probably look similar to this: |
78 | | - |
79 | | - |
80 | | -Write a title and description for your changes, then click "Commit to branch" to add your changes to the branch. |
81 | | -When ready, select `Branch -> Create pull request` to create a pull request on the main repository, and if everything goes well, it'll be merged! |
82 | | - |
83 | | -## Syncing your fork |
84 | | - |
85 | | -After new commits are pushed to the main repository, you'll want to make sure your fork is up to date. Unfortunately GitHub Desktop doesn't appear to have an easy way to do this without creating a merge commit. Open a command prompt (`Repository` -> `Open in Command Prompt` in GitHub Desktop) and run the following: |
86 | | - |
87 | | -``` |
88 | | -git remote remove upstream |
89 | | -git remote add upstream https://github.com/RigsOfRods/docs.rigsofrods.org.git |
90 | | -git fetch upstream |
91 | | -git merge upstream/master |
92 | | -``` |
93 | | - |
94 | | -To update your fork in the future, run only the last two commands. |
95 | | - |
96 | | -In GitHub Desktop, click "Push to origin" after running the above commands. |
97 | | - |
98 | | -## Conclusion |
99 | | -I hope this helps anyone who becomes interested in helping contribute to the docs. |
| 1 | +# Docs Contributing Guide |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Rigs of Rods project documentation. This guide will walk you through the process of setting up your environment, making changes, and submitting your contributions. The documentation is built using MkDocs with the Material for MkDocs theme and deployed directly to GitHub Pages. |
| 4 | + |
| 5 | +??? note "Make Quick Edits with the ":material-file-document-edit-outline:" Icon" |
| 6 | + Every page has a ":material-file-document-edit-outline:" icon in the top-right corner. Clicking this icon will take you directly to the source file on GitHub, where you can make edits and propose changes without needing to clone the repository locally. This comes in handy for small fixes like typos, broken links, or minor clarifications. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +Before you start, ensure you have the following installed: |
| 11 | + |
| 12 | +* **[git](https://git-scm.com/downloads)**: To clone the repository and push your changes. |
| 13 | +* **[Python 3.9+](https://www.python.org/downloads/)**: MkDocs is a Python-based tool. |
| 14 | +* **pip**: Python package manager, which is usually bundled with Python itself. |
| 15 | + |
| 16 | +You can alternatively use something like [GitHub Desktop](https://github.com/apps/desktop) in place of using git itself. |
| 17 | + |
| 18 | +## Setting Up Your Environment |
| 19 | + |
| 20 | +1. Fork the Repository: |
| 21 | + * Fork the repository on GitHub to your own personal GitHub account. |
| 22 | +2. Clone your Fork: |
| 23 | + ```bash |
| 24 | + $ git clone https://github.com/<YOUR_USERNAME>/docs.rigsofrods.org ror-docs |
| 25 | + $ cd ror-docs |
| 26 | + ``` |
| 27 | +3. Set Up a Virtual Environment (optional, but recommended): |
| 28 | + ```bash |
| 29 | + $ python -m venv venv |
| 30 | + $ source venv/bin/activate # On Windows, use `venv/Scripts/activate` |
| 31 | + ``` |
| 32 | +4. Install Dependencies: |
| 33 | + ```bash |
| 34 | + pip install -r requirements.txt |
| 35 | + ``` |
| 36 | + |
| 37 | +## Making Changes |
| 38 | + |
| 39 | +1. Create a New Branch: |
| 40 | + ```bash |
| 41 | + $ git checkout -b my-cool-change |
| 42 | + ``` |
| 43 | +2. Make Your Changes: |
| 44 | + * The documentation is written in Markdown (`.md`) and located in the `source/` directory. |
| 45 | +3. Update the Navigation: |
| 46 | + * Open `mkdocs.yml` at the root directory. |
| 47 | + * Add the new page to the `nav:` section, for example: |
| 48 | + ```yaml |
| 49 | + nav: |
| 50 | + - My new page: tools-tutorials/my-new-page.md |
| 51 | + ``` |
| 52 | + |
| 53 | +## Previewing Your Changes |
| 54 | + |
| 55 | +1. Run the MkDocs Development Server: |
| 56 | + ```bash |
| 57 | + $ mkdocs serve |
| 58 | + ``` |
| 59 | + * This will start a local server at `http://127.0.0.1:8000/` where you can preview your changes in real-time. |
| 60 | +2. Check for Errors: |
| 61 | + * Ensure there are no build errors or broken links. MkDocs will display errors in the terminal if any exist. |
| 62 | + |
| 63 | +## Submitting Your Contributions |
| 64 | + |
| 65 | +1. Commit Your Changes: |
| 66 | + ```bash |
| 67 | + $ git add . |
| 68 | + $ git commit -m "Your descriptive commit message" |
| 69 | + ``` |
| 70 | +2. Push to Your Fork: |
| 71 | + ```bash |
| 72 | + git push |
| 73 | + ``` |
| 74 | +3. Create a Pull Request (PR): |
| 75 | + * Go to your fork on GitHub and click "Compare & Pull Request." |
| 76 | + * Write a clear title and description for your PR, explaining the changes you made. |
| 77 | + * Submit the PR and wait for feedback from the maintainers. |
| 78 | + |
| 79 | +## Style Guide |
| 80 | + |
| 81 | +To maintain consistency across the documentation, please follow these guidelines: |
| 82 | + |
| 83 | +1. Markdown Formatting: |
| 84 | + * Use headings (`#`, `##`, `###`) to structure your content. |
| 85 | + * Use fenced code blocks for code snippets: |
| 86 | + ```markdown |
| 87 | + ```python |
| 88 | + print("Hello world") |
| 89 | + ``` |
| 90 | +2. Language and Tone |
| 91 | + * Use clear, concise, and friendly language. |
| 92 | + * Write in an active voice whenever possible. |
| 93 | +3. Admonitions: |
| 94 | + * Use Material for MkDocs admonitions to highlight important information: |
| 95 | + ```markdown |
| 96 | + !!! note |
| 97 | + This is a note. |
| 98 | + ``` |
| 99 | +4. Links: |
| 100 | + * Use relative links for internal documentation pages. |
| 101 | + * Use descriptive anchor text for external links. |
| 102 | +
|
| 103 | +## Code of Conduct |
| 104 | +
|
| 105 | +By contributing, you agree to follow our [Contributor Code of Conduct](../rules/contributor-code-of-conduct.md). Please be respectful and inclusive in all interactions. |
| 106 | +
|
| 107 | +Finally, thank you for contributing to the Rigs of Rods project and community! Your efforts will help make the project better for everyone. |
0 commit comments