|
| 1 | +# Contributor Info / Styleguide |
| 2 | + |
| 3 | +For consistency, please follow the following styleguide when submitting PRs. |
| 4 | +This page is directly lifted from [GregTech Modern] (https://github.com/GregTechCEu/GregTech-Modern) |
| 5 | + |
| 6 | + |
| 7 | +## Filenames & Basic Page Structure |
| 8 | + |
| 9 | +The file structure and basic page layout must follow these conventions: |
| 10 | + |
| 11 | +- For each section, create a directory with a short, descriptive name in `Title Case`. |
| 12 | +- File names should only contain `A-Z`, `a-z`, `0-9`, `-` and `_` (no spaces). |
| 13 | +- Directory names must use dashes (`-`) instead of spaces. |
| 14 | +- If you want to add a short description of what a section is about, include an `index.md` in its directory. |
| 15 | +- Every page of the docs must include a Markdown front matter block, containing _at least_ its title, followed by |
| 16 | + two empty lines. |
| 17 | +- Every page must start with a level-1 heading. No other level-1 headings may be added. |
| 18 | + |
| 19 | +Note that the page name/title must be as short and descriptive as possible, as it's displayed in the navigation area. |
| 20 | +You can, however, choose a longer version for the page _header_: |
| 21 | + |
| 22 | +```markdown |
| 23 | +--- |
| 24 | +title: My Page Name |
| 25 | +--- |
| 26 | + |
| 27 | + |
| 28 | +# This is my Custom Page Header! |
| 29 | + |
| 30 | +Page content here... |
| 31 | +``` |
| 32 | + |
| 33 | +Contrary to filenames, both the title and header are **not** limited to specific characters. |
| 34 | + |
| 35 | + |
| 36 | +## Empty Lines |
| 37 | + |
| 38 | +Please consider the following conventions for empty lines: |
| 39 | + |
| 40 | +- At least two empty lines before each heading |
| 41 | +- Exactly one line after each heading |
| 42 | +- Separate each "element" of a page by an empty line inbetween |
| 43 | + (code blocks, lists, [admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions/), etc.) |
| 44 | + |
| 45 | + |
| 46 | +## Formatting |
| 47 | + |
| 48 | +Please use the following formatting rules for standard markdown: |
| 49 | + |
| 50 | +- Use double asterisks for bold text (`**bold**`) and underscores for italics (`_italics_`) |
| 51 | +- Each code block must include a language whenever possible, so that syntax highlighting is applied correctly |
| 52 | + |
| 53 | + |
| 54 | +## Index Pages |
| 55 | + |
| 56 | +Only use index pages for a short description of what the current section is about. |
| 57 | + |
| 58 | +Do not include any important documentation on index pages! |
| 59 | +You may link to certain relevant pages (either inside the current section, or in other sections) though. |
| 60 | + |
| 61 | + |
| 62 | +## Admonitions |
| 63 | + |
| 64 | +Use [admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions/) in the following situations: |
| 65 | + |
| 66 | +- If you want to provide potentially useful, additional info about a feature, use an `info` admonition. |
| 67 | +- For "see also" references, use an `info inline end` admonition. |
| 68 | +- For tips / recommendations on _when_ or _how_ to use a feature, use he `tip` admonition type. |
| 69 | + - For general notes on _when_ or _how_ to use a specific feature (in development related docs), use the `note` type. |
| 70 | +- For warning about possible bugs or unwanted behavior, use the `warning` type. |
| 71 | +- If a feature may result in destructive actions in certain scenarios, use the `danger` type. |
| 72 | +- For providing code examples, use the `example` type. |
| 73 | + - **Always** provide a title for code examples, even if it's simply "Example usage". |
| 74 | + - Use collapsible blocks (`??? example "my example title"` instead of `!!!`) for code examples where possible. |
| 75 | + _In some situations this might not be as useful as using a non-collapsible block. Just fall back to `!!!` in these cases._ |
| 76 | +- For pages or sections that are not documented yet, use `!!! failure "Not yet documented"` |
| 77 | +- For links, use the (custom) `link` type. |
| 78 | + |
| 79 | +We suggest adding an empty line after the title for consistency, like in the following example. |
| 80 | +It is **strongly recommended** to include a custom, descriptive title for your admonition, if possible. |
| 81 | + |
| 82 | + |
| 83 | +```markdown |
| 84 | +!!! note "My descriptive title" |
| 85 | + |
| 86 | + This is my note's content |
| 87 | +``` |
| 88 | + |
| 89 | + |
| 90 | +### Admonitions for experimental or not-yet-merged features |
| 91 | + |
| 92 | +If a feature is either not yet merged or simply not stable yet, please add a title-only `warning inline end` before its |
| 93 | +description, as shown below. |
| 94 | + |
| 95 | +For additional info (e.g. which branch the feature is currently in), add a `<br>` tag in the title, followed by the |
| 96 | +additional info in italics. |
| 97 | +If your additional information needs to be more detailed than that, consider using a collapsible admonition instead. |
| 98 | + |
| 99 | +```markdown |
| 100 | +!!! warning inline end "Not merged yet.<br>_Branch: `my-branch-name`_" |
| 101 | + |
| 102 | +Paragraph containing the feature's description... |
| 103 | +``` |
| 104 | + |
| 105 | +Here are some good examples you could use as the first line of your warning: |
| 106 | + |
| 107 | +- Experimental |
| 108 | +- Unstable |
| 109 | +- Not yet implemented |
| 110 | +- Not merged yet |
| 111 | + |
| 112 | + |
| 113 | +## Annotations |
| 114 | + |
| 115 | +Use [annotations](https://squidfunk.github.io/mkdocs-material/reference/annotations/) in the following situations: |
| 116 | + |
| 117 | +- Explanatory comments in code examples (preferred over including these as an actual comment) |
| 118 | +- Additional explanations to a specific aspect of your documented feature |
| 119 | +- An explanation for a technical term used in your documentation |
| 120 | + |
| 121 | +There must be an empty line before the first annotation or they won't work properly. |
| 122 | + |
| 123 | +Also add an empty line between each annotation if at least one in the current block is longer than a single line. |
| 124 | +In that case, add two empty lines after the end of the annotation list. |
| 125 | + |
| 126 | +Annotations must be numbered starting at 1 **for each block** of consecutive annotations. |
| 127 | +If they are separated by another element, you need to start at 1 again for the next block of annotations: |
| 128 | + |
| 129 | + |
| 130 | +~~~markdown |
| 131 | +```java |
| 132 | +someVar.someMethod(); // (1) |
| 133 | +return someVar; // (2) |
| 134 | +``` |
| 135 | + |
| 136 | +1. annotation 1 for the first code block |
| 137 | +2. annotation 2 for the first code block |
| 138 | + |
| 139 | + |
| 140 | +```java |
| 141 | +someVar.anotherMethod(); // (1) |
| 142 | +``` |
| 143 | + |
| 144 | +1. annotation 1 for the second code block |
| 145 | +~~~ |
0 commit comments