Thank you for your interest in contributing to Algo! We welcome contributions from everyone, whether you're a beginner or an experienced developer. Contributions can include adding new algorithms, improving documentation, fixing bugs, or enhancing the user experience. This guide will help you get started.
Here are some resources that may be helpful as you contribute to Algo:
- Docusaurus Documentation
- React.js Documentation
- Markdown Guide
- MDX Documentation
- Mermaid Documentation
- KaTeX Math Rendering Documentation
- Math Equations
Start by forking the repository to your GitHub account. This creates a copy of the repository under your account.
Clone the repository to your local machine using:
$ git clone https://github.com/<your-username>/algo.git
cd algo
git remote add upstream https://github.com/ajay-dhangar/algo.git
git remote -v
6. ⬇️ Always take a pull from the upstream repository to your main branch to keep it up-to-date with the main project (updated repository).
git pull upstream main
git checkout -b <your-branch-name>
Make your changes, which could include:
- Adding new algorithms
- Improving existing documentation
- Creating new documentation pages
- Fixing bugs
If your contribution involves documentation, here’s how to write effective content using Docusaurus:
- Documentation should be written in Markdown (
.md
) or MDX (.mdx
), which supports JSX syntax. - MDX allows you to use React components inside Markdown files. This helps add interactive elements or custom components.
Each documentation file should start with a front-matter section for Docusaurus to recognize the page:
---
id: <unique-id>
title: <Page Title>
sidebar_label: <Sidebar Label>
sidebar_position: <Position in Sidebar>
description: <Short Description>
tags: [<tag1>, <tag2>]
---
- id: A unique identifier for the page.
- title: The page title.
- sidebar_label: The label is displayed in the sidebar.
- sidebar_position: Order of the page in the sidebar.
- description: A short description of the page content.
- tags: Tags for categorizing content.
- Use
#
for the main title,##
for subsections, and###
for sub-subsections. - Ensure headings follow a logical order.
-
Use fenced code blocks for code snippets:
```python def binary_search(arr, target): low, high = 0, len(arr) - 1 while low <= high: mid = (low + high) // 2 if arr[mid] == target: return mid elif arr[mid] < target: low = mid + 1 else: high = mid - 1 return -1 ```
-
Use KaTeX for rendering math expressions:
$$ E = mc^2 $$
-
Refer to the KaTeX documentation for supported features.
-
Create diagrams using Mermaid syntax:
```mermaid graph TD; A-->B; A-->C; B-->D; C-->D; ```
-
Import React components for interactivity:
import MyComponent from '@site/src/components/MyComponent'; <MyComponent />
Commit your changes with a descriptive message:
$ git commit -m "Added algorithm for [algorithm-name]"
Push your changes to the forked repository:
$ git push origin <branch-name>
Go to the original repository and create a Pull Request (PR). Provide a clear description of what was added or changed and why. Reference any related issues in your PR description.
- Keep your code clean and readable.
- Follow standard coding conventions for the language used.
- Add comments for complex code to help others understand.
- Make sure your contributions align with the project’s goals and guidelines.
- Keep PRs focused on a single issue; avoid making unrelated changes.
- Respect the repository structure and follow best practices.
Thank you for contributing! Let's build Algo and create an amazing learning platform for mastering Data Structures and Algorithms. ✨