|
| 1 | +# Markdown Cheatsheet |
| 2 | + |
| 3 | +There are basic markdown features recommended for use in Pulp. |
| 4 | + |
| 5 | +### Internal links |
| 6 | + |
| 7 | +=== "Template" |
| 8 | + |
| 9 | + ```markdown |
| 10 | + [My Link](site:{repo-name}/docs/{persona}/{content-type}/some-page.md). |
| 11 | + ``` |
| 12 | + |
| 13 | +=== "Sample" |
| 14 | + |
| 15 | + ```markdown |
| 16 | + [My Link](site:pulp-docs/docs/dev/reference/markdown-cheatsheet.md). |
| 17 | + ``` |
| 18 | + |
| 19 | +=== "Sample Rendered" |
| 20 | + |
| 21 | + ```markdown |
| 22 | + [My Link](http://127.0.0.1:8000/pulp-docs/docs/dev/reference/markdown-cheatsheet/). |
| 23 | + ``` |
| 24 | + |
| 25 | +- This is enabled by [mkdocs-site-urls](https://github.com/octoprint/mkdocs-site-urls) plugin. |
| 26 | +- This is preferred over *relative* links because of our complex structure. See tradeoffs [here](https://github.com/pedro-psb/pulp-docs/issues/2) |
| 27 | + |
| 28 | + |
| 29 | +### Codeblocks |
| 30 | + |
| 31 | + |
| 32 | +=== "Raw" |
| 33 | + |
| 34 | + ```` |
| 35 | + ``` |
| 36 | + <location "/pulp/api/v3/foo_route"> |
| 37 | + proxypass /pulp/api http://${pulp-api}/pulp/api |
| 38 | + proxypassreverse /pulp/api http://${pulp-api}/pulp/api |
| 39 | + requestheader set foo "asdf" |
| 40 | + </location> |
| 41 | + ``` |
| 42 | + ```` |
| 43 | + |
| 44 | + --- |
| 45 | + |
| 46 | + ``` |
| 47 | + <location "/pulp/api/v3/foo_route"> |
| 48 | + proxypass /pulp/api http://${pulp-api}/pulp/api |
| 49 | + proxypassreverse /pulp/api http://${pulp-api}/pulp/api |
| 50 | + requestheader set foo "asdf" |
| 51 | + </location> |
| 52 | + ``` |
| 53 | + |
| 54 | +=== "Python Language" |
| 55 | + |
| 56 | + ```` |
| 57 | + ```python |
| 58 | + serializer = mymodelserializer(data=data) |
| 59 | + serializer.is_valid(raise_exception=true) |
| 60 | + instance = serializer.create(serializer.validated_data) |
| 61 | + ``` |
| 62 | + ```` |
| 63 | + |
| 64 | + --- |
| 65 | + |
| 66 | + ```python |
| 67 | + serializer = mymodelserializer(data=data) |
| 68 | + serializer.is_valid(raise_exception=true) |
| 69 | + instance = serializer.create(serializer.validated_data) |
| 70 | + ``` |
| 71 | + |
| 72 | +=== "Python REPL" |
| 73 | + |
| 74 | + ```` |
| 75 | + ```python |
| 76 | + >>> serializer = mymodelserializer(data=data) |
| 77 | + >>> serializer.is_valid(raise_exception=true) |
| 78 | + >>> instance = serializer.create(serializer.validated_data) |
| 79 | + Some output |
| 80 | + ``` |
| 81 | + ```` |
| 82 | + |
| 83 | + --- |
| 84 | + |
| 85 | + ```python |
| 86 | + >>> serializer = mymodelserializer(data=data) |
| 87 | + >>> serializer.is_valid(raise_exception=true) |
| 88 | + >>> instance = serializer.create(serializer.validated_data) |
| 89 | + Some output |
| 90 | + ``` |
| 91 | + |
| 92 | +=== "With 'Title'" |
| 93 | + |
| 94 | + ```` |
| 95 | + ```bash title="script.sh" |
| 96 | + pulp file repository update --name myrepo --retained-versions 1 |
| 97 | + ``` |
| 98 | + ```` |
| 99 | + |
| 100 | + --- |
| 101 | + |
| 102 | + ```bash title="script.sh" |
| 103 | + pulp file repository update --name myrepo --retained-versions 1 |
| 104 | + ``` |
| 105 | + |
| 106 | +### Tabbed content |
| 107 | + |
| 108 | + |
| 109 | +<div class="grid" markdown> |
| 110 | + |
| 111 | +```` |
| 112 | +=== "Run" |
| 113 | +
|
| 114 | + ```bash |
| 115 | + cat myfile.txt |
| 116 | + ``` |
| 117 | +
|
| 118 | +=== "Output" |
| 119 | +
|
| 120 | + ```bash |
| 121 | + line1 |
| 122 | + line2 |
| 123 | + line3 |
| 124 | + ``` |
| 125 | +```` |
| 126 | + |
| 127 | +=== "Run" |
| 128 | + |
| 129 | + ```bash |
| 130 | + cat myfile.txt |
| 131 | + ``` |
| 132 | + |
| 133 | +=== "Output" |
| 134 | + |
| 135 | + ```bash |
| 136 | + line1 |
| 137 | + line2 |
| 138 | + line3 |
| 139 | + ``` |
| 140 | + |
| 141 | +</div> |
| 142 | + |
| 143 | +- [See mkdocs-material](https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#usage) |
| 144 | +- Each tab title must be in quotes |
| 145 | +- Each tab block must have 4 spaces of indent |
| 146 | +- Put space around `=== "Title"` |
| 147 | + |
| 148 | +### Admonitions |
| 149 | + |
| 150 | +[See mkdocs-material](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#supported-types) |
| 151 | + |
| 152 | +Use them wisely. |
| 153 | + |
0 commit comments