Skip to content

Commit 12c4288

Browse files
committed
update contribution guide
1 parent 4a9548d commit 12c4288

File tree

3 files changed

+44
-74
lines changed

3 files changed

+44
-74
lines changed

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,3 @@ Translation of http://e-maxx.ru into English
1212
Compiled pages are published at https://cp-algorithms.com/
1313

1414
Manual for contributors: https://cp-algorithms.com/contrib.html
15-
16-
## Prerequisits
17-
18-
```sh
19-
pip install mkdocs-material
20-
```
21-
22-
## Compile pages
23-
24-
```sh
25-
mkdocs serve
26-
```

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ markdown_extensions:
2727
- pymdownx.highlight
2828
- pymdownx.superfences
2929
- attr_list
30+
- pymdownx.emoji:
31+
emoji_index: !!python/name:materialx.emoji.twemoji
32+
emoji_generator: !!python/name:materialx.emoji.to_svg
3033
extra_javascript:
3134
- javascript/config.js
3235
- https://polyfill.io/v3/polyfill.min.js?features=es6

src/contrib.md

Lines changed: 41 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,54 @@ hide:
77

88
## General information
99

10-
We collaborate via means of github.
10+
This website (articles, design, ...) is developed via [Github](https://github.com/e-maxx-eng/e-maxx-eng). And everybody is welcome to help out. All you need is a Github account.
1111

1212
Generated pages are compiled and published at [https://cp-algorithms.com](https://cp-algorithms.com).
1313

14-
And sources (to which you may want to contribute) are [here](http://github.com/e-maxx-eng/e-maxx-eng/tree/master/src).
15-
1614
In order to make contribution consider the following steps:
1715

18-
1. Fork [source repository](https://github.com/e-maxx-eng/e-maxx-eng).
19-
2. Add or modify files in `src` subfolder in Markdown format (you can do this in web-interface of github now).
20-
3. Make sure you added `<!--?title ... -->` to your page and the corresponding link to main (index) page.
21-
3. Use [Test-Your-Page form](./preview.html) to check if you are satisfied with the result.
22-
4. Use `pull-request` feature to send the request for your changes to be merged.
23-
5. It may take few hours or few days before someone who have admin rights will merge your request. Contact any of admins personally to speed up this process!
24-
6. After merging it will take about 5 minutes before updated html page will appear at the site.
25-
26-
**You may start with this [demo-article](demo-article.md) or even use [its source](https://raw.githubusercontent.com/e-maxx-eng/e-maxx-eng/master/src/contrib.md) as a template for your new article.**
27-
28-
Please kindly refer to manuals on using `git` and `github` anywhere over internet. You may also watch this demo video:
16+
1. Go to an article that you want to change, and click the pencil icon :material-pencil: next to the article title.
17+
2. Fork the repository if requested.
18+
3. Modify the article.
19+
4. Use the [preview page](./preview.html) to check if you are satisfied with the result.
20+
5. Make a commit by clicking the _Propose changes_ button.
21+
6. Create a pull-request by clicking the _Compare & pull request_ button.
22+
7. Somebody from the core team will look over the changes. This might take a few hours/days.
2923

30-
<div style="text-align:center">
31-
<iframe width="420" height="315" src="https://www.youtube.com/embed/TrBBw4J9X30" frameborder="0" allowfullscreen></iframe>
32-
</div>
24+
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.
25+
If you are unfamiliar with the workflow, read [Step-by-step guide to contributing on GitHub](https://www.dataschool.io/how-to-contribute-on-github/).
3326

34-
## Your Authorship is Preserved
27+
In case you are adding a new article, start by copying some other article in order to have the required header lines, and make sure to link to the article from the main (index.md) page.
3528

36-
Some contributors add explicit links to their profiles at the bottom of the translated articles. However it is discouraged and simply not very convenient if the article was edited by several people. Every page has `Page Authors` link in its top - this link leads to the github commit history, so it is always easy to determine or prove the authorship (even of any single line). Just make sure that your GitHub profile (which is mentioned in history) provides enough information about you.
29+
## Syntax
3730

38-
## Source format
31+
We use [Markdown](https://daringfireball.net/projects/markdown) for the articles, and use the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) to render the Markdown articles into HTML.
3932

40-
We use [Markdown](https://daringfireball.net/projects/markdown) for source texts and
41-
convert them automatically to HTML.
42-
Some [extra](https://michelf.ca/projects/php-markdown/extra/) features also could be used.
33+
For advanced Markdown features of Material for MkDocs see their [reference pages](https://squidfunk.github.io/mkdocs-material/reference/formatting), like:
4334

44-
Formulas could be added thanks to `MathJax` library. Simply use `TeX` expressions inside single or double dollar marks `$`, for example:
35+
- [Math formulas with MathJax](https://squidfunk.github.io/mkdocs-material/reference/mathjax/#usage)
36+
Notice that you need to have an empty line before and after a `$$` math block.
37+
- [Data tables](https://squidfunk.github.io/mkdocs-material/reference/data-tables/#usage)
4538

46-
here is an inline equation: $P \ne NP$
47-
48-
And here is the formula in the separate block:
49-
50-
$$E = mc^{2}$$
39+
However not everything of the features should be used, and some of the features are not enabled or require a paid subscription.
5140

5241
## Some conventions
5342

5443
* We have agreed as of issue [#83](https://github.com/e-maxx-eng/e-maxx-eng/issues/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$.
5544

5645
## Adding Problems
57-
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.
58-
59-
## Adding images
60-
61-
Small images could be pushed along with texts to the [/img](https://github.com/e-maxx-eng/e-maxx-eng/tree/master/img) subfolder. Let them be in `PNG` format and less than `200kb`. Then you can refer to them inside the article with the tag:
62-
63-
![some image description](&imgroot&/my-image.png)
64-
65-
Here `my-image.png` should be your file name, while `&imgroot&` is some magic which will expand to proper url prefix when shown at the site (so you need not know the precise prefix of github raw data).
66-
67-
Larger images should be posted to some image-hosting, like [PostImage](http://postimage.org) or [ImgUr](http://imgur.com/) - they will then give you the url to insert into the page.
6846

69-
## Modifying CSS and JS files
70-
71-
This is not something you usually need to do, when just writing content. It is rather for exceptional cases there arose necessity to improve general page style or behavior. These files are (due to certain technical reasons) in the other branch of the same github repository: https://github.com/e-maxx-eng/e-maxx-eng/tree/gh-pages - please, be careful here, as usually changes will affect the whole site. Also make sure site's cache and your browser cache is expired after changes done, otherwise testing could be bewildering.
72-
73-
## Creating anchors and link to them
74-
75-
It is possible to generate HTML anchors for sections of an article.
76-
E.g. the following generates a header and a named anchor.
77-
78-
## Implementation ## {#implementation}
79-
80-
And then link to it from the same or a different article:
81-
82-
For more detail read the [Implementation](#implementation).
83-
More infos in [Impl. of Segmenttree](./data_structures/segment_tree.html#implementation).
84-
85-
## Page Template
47+
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.
8648

87-
Template for the pages (the one which creates small violet header and footer, determines the layout of the text, includes css and js files) is now also stored in this repo, in [src/\_templates](https://github.com/e-maxx-eng/e-maxx-eng/tree/master/src/_templates) folder. So in case you find some bugs in it, or with the passing of time some new features may be needed in it - create PR to improve it. Note that for testing purposes the alternative template could be created and used for specific page with the inclusion of special comment as shown below:
49+
## Local development
8850

89-
`<!--?template myfunnytemplate-->`
51+
You can render the pages very easily also locally.
52+
All you need is Python, with the installed `mkdocs-material` package.
9053

91-
The templates are cached for about 3600 seconds, rather than 300 seconds for ordinary pages, so be patient :)
54+
```console
55+
$ pip install mkdocs-material
56+
$ mkdocs serve
57+
```
9258

9359
## Tests
9460

@@ -98,7 +64,7 @@ This way we can make sure that the snippets actually work, and don't contain any
9864
Creating tests works like this:
9965
You have to name each snippet that you want to test in the markdown article:
10066

101-
```cpp snippet-name
67+
```{.cpp file=snippet-name}
10268
// some code
10369
```
10470

@@ -108,4 +74,17 @@ In the folder you can create a cpp file, that includes these snippets headers, a
10874
If the snippets don't work, the test program should return 1 instead of 0.
10975

11076
You can run all tests with the script `test.sh`.
111-
Also, every pull-request will automatically tested via [Travis CI](https://travis-ci.org/e-maxx-eng/e-maxx-eng/), and the result of the tests will be shown.
77+
78+
```console
79+
$ cd test
80+
$ ./test.sh
81+
Running test_aho_corasick.cpp - Passed in 635 ms
82+
Running test_balanced_brackets.cpp - Passed in 1390 ms
83+
Running test_burnside_tori.cpp - Passed in 378 ms
84+
...
85+
Running test_vertical_decomposition.cpp - Passed in 2397 ms
86+
87+
51 PASSED in 49.00 seconds
88+
```
89+
90+
Also, every pull-request will automatically tested via [Github Actions](https://travis-ci.org/e-maxx-eng/e-maxx-eng/).

0 commit comments

Comments
 (0)