Skip to content

How to Contribute

General information

This website (articles, design, ...) is developed via Github. And everybody is welcome to help out. All you need is a Github account.

Generated pages are compiled and published at https://cp-algorithms.com.

In order to make contribution consider the following steps:

  1. Go to an article that you want to change, and click the pencil icon next to the article title.
  2. Fork the repository if requested.
  3. Modify the article.
  4. Use the preview page to check if you are satisfied with the result.
  5. Make a commit by clicking the Propose changes button.
  6. Create a pull-request by clicking the Compare & pull request button.
  7. Somebody from the core team will look over the changes. This might take a few hours/days.

In case you want to make some bigger changes, like adding a new article, or edit multiple files, you should fork the project in the traditional way, create a branch, modify the files in the Github UI or locally on your computer, and create a pull-request. If you are unfamiliar with the workflow, read Step-by-step guide to contributing on GitHub.

In case you are adding a new article, make sure to link to the article from the main (index.md) page and in README.md to announce it.

Syntax

We use Markdown for the articles, and use the Material for MkDocs to render the Markdown articles into HTML.

For advanced Markdown features of Material for MkDocs see their reference pages, like:

However not everything of the features should be used, and some of the features are not enabled or require a paid subscription.

By default the first header (# header) will be also the HTML title of the article. In case the header contains a math formula, you can define a different HTML title with:

---
title: Alternative HTML title
---
# Proof of $a^2 + b^2 = c^2$

remaining article

Some conventions

  • We have agreed as of issue #83 to express binomial coefficients with \binom{n}{k} instead of C_n^k. The first one renders as \(\binom{n}{k}\) and is a more universal convention. The second would render as \(C_n^k\).

Adding Problems

Try to add problems in ascending order of their difficulty. If you don't have enough time to do so, still add the problem. Lets hope that the next person will sort them accordingly.

Local development

You can render the pages very easily also locally. All you need is Python, with the installed mkdocs-material package.

$ pip install mkdocs-material
$ mkdocs serve

Tests

If your article involves code snippets, then it would be great you also contribute tests for them. This way we can make sure that the snippets actually work, and don't contain any bugs.

Creating tests works like this: You have to name each snippet that you want to test in the markdown article:

```{.cpp file=snippet-name}
// some code
```

In the directory test you find a script extract_snippets.py that you can run. This script extracts from every article all named snippets, and puts them in C++ header files: snippet-name.h In the folder you can create a cpp file, that includes these snippets headers, and tests their behaviour. If the snippets don't work, the test program should return 1 instead of 0.

You can run all tests with the script test.sh.

$ cd test
$ ./test.sh
Running test_aho_corasick.cpp - Passed in 635 ms
Running test_balanced_brackets.cpp - Passed in 1390 ms
Running test_burnside_tori.cpp - Passed in 378 ms
...
Running test_vertical_decomposition.cpp - Passed in 2397 ms

51 PASSED in 49.00 seconds

Also, every pull-request will automatically tested via Github Actions.