Comprehensive Guide for New Contributors
Welcome to our MkDocs project! This guide will help you set up your environment, make contributions, and deploy changes. Whether you're new to GitHub or MkDocs, follow these step-by-step instructions to get started.
Prerequisites
Before you begin, ensure you have the following tools installed:
- Visual Studio Code (VSCode): A powerful and free code editor.
-
Download and install VSCode from here.
-
Git: A version control system to manage code changes.
-
Download and install Git from here.
-
Python: A programming language required to run MkDocs.
- Download and install Python from here.
Setting Up the Project
-
Fork the Repository
-
Go to the project repository on GitHub and click on the "Fork" button in the upper right corner to create a copy of the repository under your GitHub account.
-
Clone Your Fork
-
Open VSCode.
- Open the terminal in VSCode by selecting
View > Terminal
or using the shortcutCtrl+`
. -
In the terminal, clone your forked repository by running:
bash git clone https://github.com/your-username/your-repository.git cd your-repository
-
Create a Virtual Environment
-
Set up a virtual environment to manage your dependencies. In the terminal, run:
bash python -m venv env
-
Activate the virtual environment:
- On Windows:
bash env\Scripts\activate
- On macOS and Linux:
bash source env/bin/activate
-
Install Dependencies
-
Install MkDocs and the Material theme by running:
bash pip install mkdocs mkdocs-material
-
Run the Project Locally
-
Start the MkDocs development server to see your changes live:
bash mkdocs serve
-
Open your browser and go to
http://127.0.0.1:8000/
to view the site.
Making Contributions
Creating a New Page
-
Create a Markdown File
-
In VSCode, create a new file in the
docs
directory. For example:bash docs/new_page.md
-
Add Content to the Page
-
Open the new file in VSCode and add your content using Markdown syntax.
-
Update the Navigation
-
Open
mkdocs.yml
in VSCode and add your new page to the navigation:yaml nav: - Home: index.md - About: about.md - New Page: new_page.md
Editing Existing Pages
-
Locate the File
-
In VSCode, navigate to the
docs
directory and find the Markdown file you want to edit. -
Make Your Changes
-
Open the file in VSCode and make your changes.
Committing and Pushing Changes
-
Stage Your Changes
-
In the terminal, stage your changes:
bash git add .
-
Commit Your Changes
-
Commit your changes with a descriptive message:
bash git commit -m "Describe your changes"
-
Push to Your Fork
-
Push your changes to your forked repository:
bash git push origin main
-
Create a Pull Request
-
Go to the original repository on GitHub.
- Click on the "Pull Requests" tab and then "New pull request".
- Select your branch and create a pull request.
Deploying Changes
Our project uses GitHub Actions to automatically deploy changes to GitHub Pages.
GitHub Actions Workflow
-
Ensure Your Workflow File is Correct
-
The
.github/workflows/deploy.yml
file should look like this:```yaml name: Deploy to GitHub Pages
on: push: branches: - main