Cheatsheet.cheatmd (3594B)
1 # Cheatsheet User Guide 2 3 This document is a cheatsheet on how to use cheatsheets. 4 Cheatsheets are Markdown files with the `.cheatmd` extension. You may also check the source of this document as a reference. 5 6 ## I'm a H2 title with 2 columns 7 {: .col-2} 8 9 ### I'm a H3 title 10 11 #### I'm a H4 title. 12 13 And this is a paragraph. 14 15 ### Code 16 17 ```elixir 18 # hello.exs 19 defmodule Greeter do 20 def greet(name) do 21 message = "Hello, " <> name <> "!" 22 IO.puts message 23 end 24 end 25 26 Greeter.greet("world") 27 ``` 28 29 ### Paragraphs 30 31 Paragraphs are also supported and can quote `code`. 32 33 Several paragraphs are visually distinct. 34 35 ### Lists 36 37 - Element 1 38 - Element 2 39 - `piece of code` 40 41 42 ### Table 43 44 #### Date 45 46 | Example | Output | 47 | --- | --- | 48 | `%m/%d/%Y` | `06/05/2013` | 49 | `%A, %B %e, %Y` | `Sunday, June 5, 2013` | 50 | `%b %e %a` | `Jun 5 Sun` | 51 52 This is a basic table with a h4 header. 53 54 ## Variants 55 {: .col-2} 56 57 ### Adding variants 58 59 ``` 60 ## H2 61 {: .col-2} 62 63 ### H3 64 {: .list-6} 65 66 * example 1 67 * example 2 68 ``` 69 70 Variants customize how your cheatsheet looks like via Markdown's inline attribute notation. 71 72 ### Header variants 73 74 #### H2 75 76 | `.col-2` | two-columns | 77 | `.col-3` | three-columns | 78 | `.col-2-left` | two-columns (1/3 - 2/3) | 79 80 #### H3 81 82 | `.list-4` | four-columns for lists | 83 | `.list-6` | six-columns for lists | 84 85 ## Code 86 {: .col-3} 87 88 ### Code with headings 89 90 #### index.ex 91 92 ``` 93 Path.join(["~", "foo"]) 94 "~/foo" 95 ``` 96 97 #### other.ex 98 99 ``` 100 Path.join(["foo"]) 101 "foo" 102 ``` 103 104 Code blocks can have headings. 105 106 ### Long lines 107 108 ```elixir 109 defmodule MyTracer do 110 def trace({:remote_function, _meta, module, name, arity}, env) do 111 IO.puts "#{env.file}:#{env.line} #{inspect(module)}.#{name}/#{arity}" 112 :ok 113 end 114 115 def trace(_event, _env) do 116 :ok 117 end 118 end 119 ``` 120 121 Long lines will have scrollbars on hover. 122 123 ### Line wrapping 124 125 ```elixir 126 defmodule MyTracer do 127 def trace({:remote_function, _meta, module, name, arity}, env) do 128 IO.puts "#{env.file}:#{env.line} #{inspect(module)}.#{name}/#{arity}" 129 :ok 130 end 131 132 def trace(_event, _env) do 133 :ok 134 end 135 end 136 ``` 137 {: .wrap} 138 139 Add `wrap` to wrap long lines. 140 141 ## Lists 142 {: .col-2} 143 144 ### Bullet lists 145 146 - This is 147 - a list 148 - with a few items 149 150 ### Ordered lists 151 152 1. I'm first; 153 2. You are second; 154 3. We are third; 155 156 Here's an extra paragraph after the list. 157 158 ### With headings and code links 159 160 #### Part 1 161 162 - `is_atom/1` 163 - `is_binary/1` 164 - `is_number/1` 165 166 #### Part 2 167 168 - `length/1` 169 - `elem/2` 170 171 ## List columns 172 173 ### Six columns 174 {: .list-6} 175 176 - One 177 - Two 178 - Three 179 - Four 180 - Five 181 - Six 182 - Seven 183 - Eight 184 - Nine 185 - Ten 186 - Eleven 187 188 Add `{: .list-6}` after the H3 title to make large lists. 189 190 ### Four columns 191 {: .list-4} 192 193 - One 194 - Two 195 - Three 196 - Four 197 - Five 198 - Six 199 - Seven 200 - Eight 201 - Nine 202 - Ten 203 - Eleven 204 205 Add `{: .list-4}` after the H3 title to make large lists. 206 207 ## Full page 208 209 This is the default. 210 211 ## Half width 212 {: .width-50} 213 214 ### I make tables look nicer 215 216 #### Time 217 218 | Example | Output | 219 | --- | --- | 220 | `%H:%M` | `23:05` | 221 | `%I:%M %p` | `11:05 PM` | 222 223 Add `{: .width-50}` after the H2 title to use only half width. 224 225 ## Column left reference 226 {: .col-2-left} 227 228 ### One 229 230 ```elixir 231 # hello.exs 232 defmodule Greeter do 233 def greet(name) do 234 message = "Hello, " <> name <> "!" 235 IO.puts message 236 end 237 end 238 239 Greeter.greet("world") 240 ``` 241 242 ### Two 243 244 ```elixir 245 user = %{ 246 name: "John", 247 city: "Melbourne" 248 } 249 ``` 250 251 ```elixir 252 IO.puts "Hello, " <> user.name 253 ``` 254 255 ### Three 256 257 * Yet 258 * Another 259 * List 260 261 ### Four 262 263 I'm a grid, with 1/3 - 2/3 width.