|
| 1 | +<!--?title Demo Article--> |
| 2 | + |
| 3 | +#Demo Article |
| 4 | + |
| 5 | +_You can [see the source of this article](https://raw.githubusercontent.com/e-maxx-eng/e-maxx-eng/master/src/demo-article.md) to better understand formatting features._ |
| 6 | + |
| 7 | +The header is made of line starting with `#` (hash) symbol. Note that also we need to add a magical `?title` comment which |
| 8 | +defines the title of the resulting HTML page for browser and search engines. It could be placed anywhere on a separate line |
| 9 | +in the form: |
| 10 | + |
| 11 | + <!--?title Demo Article--> |
| 12 | + |
| 13 | +Text is written in paragraphs, separated with empty lines. Line breaks in paragraphs are regarded as ordinary spaces. If you |
| 14 | +add a couple of extra spaces in the line end, they will create "hard line-break" in that place. |
| 15 | + |
| 16 | +We use a kind of LaTeX renderer for formulas. It looks like this: |
| 17 | +$\phi (n) =$ the number of positive integers |
| 18 | +less than $n$ that are relatively prime to $n$ |
| 19 | +where $n >=1$. |
| 20 | + |
| 21 | +The code snippets are created of blocks indented with 4 spaces: |
| 22 | + |
| 23 | + #include <stdio.h> |
| 24 | + int main() { |
| 25 | + printf("Hello, World\n"); |
| 26 | + } |
| 27 | + |
| 28 | +For long blocks it would be good to add "show/hide" button. It is created by adding small magic span in the end of |
| 29 | +the preceding paragraph <span class="toggle-code">Show/Hide</span> |
| 30 | + |
| 31 | + int phi(int n) { |
| 32 | + int result = n; |
| 33 | + for(int i = 2; i * i <= n; ++i) |
| 34 | + if(n % i == 0) { |
| 35 | + while(n % i == 0) |
| 36 | + n /= i; |
| 37 | + result -= result / i; |
| 38 | + } |
| 39 | + if(n > 1) |
| 40 | + result -= result / n; |
| 41 | + return result; |
| 42 | + } |
| 43 | + |
| 44 | +###TeX and Markdown references |
| 45 | + |
| 46 | +###Source format |
| 47 | + |
| 48 | +We use [Markdown](https://daringfireball.net/projects/markdown) for source texts and |
| 49 | +convert them automatically to HTML. |
| 50 | +Some [extra](https://michelf.ca/projects/php-markdown/extra/) features also could be used. |
| 51 | + |
| 52 | +Formulas could be added thanks to `MathJax` library. Simply use `TeX` expressions inside single or double dollar marks `$`, for example: |
| 53 | + |
| 54 | +here is an inline equation: $P \ne NP$ |
| 55 | + |
| 56 | +And here is the formula in the separate block: |
| 57 | + |
| 58 | +$$E = mc^{2}$$ |
| 59 | + |
| 60 | +###Adding images |
| 61 | + |
| 62 | +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: |
| 63 | + |
| 64 | +  |
| 65 | + |
| 66 | +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). |
| 67 | + |
| 68 | +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. |
| 69 | + |
| 70 | +You can also embed videos from youtube, as it is done in the `contrib.md` file. |
0 commit comments