├── .npmrc ├── .gitattributes ├── .gitignore ├── .editorconfig ├── package.json ├── license ├── readme.md ├── github-markdown.css └── index.html /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.yml] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-markdown-css", 3 | "version": "3.0.1", 4 | "description": "The minimal amount of CSS to replicate the GitHub Markdown style", 5 | "license": "MIT", 6 | "repository": "sindresorhus/github-markdown-css", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "main": "github-markdown.css", 13 | "engines": { 14 | "node": ">=0.10.0" 15 | }, 16 | "scripts": { 17 | "make": "github-markdown-css > github-markdown.css" 18 | }, 19 | "files": [ 20 | "github-markdown.css" 21 | ], 22 | "keywords": [ 23 | "browser", 24 | "github", 25 | "markdown", 26 | "md", 27 | "css", 28 | "style", 29 | "stylesheet" 30 | ], 31 | "devDependencies": { 32 | "generate-github-markdown-css": "^3.0.2" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # github-markdown-css 2 | 3 | > The minimal amount of CSS to replicate the GitHub Markdown style 4 | 5 | [](http://sindresorhus.com/github-markdown-css) 6 | 7 | ## [Demo](http://sindresorhus.com/github-markdown-css) 8 | 9 | 10 | ## Install 11 | 12 | Download [manually](https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css), from [CDNJS](https://cdnjs.com/libraries/github-markdown-css), or with npm: 13 | 14 | ``` 15 | $ npm install github-markdown-css 16 | ``` 17 | 18 | 19 | ## Usage 20 | 21 | Import the `github-markdown.css` file and add a `markdown-body` class to the container of your rendered Markdown and set a width for it. GitHub uses `980px` width and `45px` padding, and `15px` padding for mobile. 22 | 23 | ```html 24 | 25 | 26 | 41 |
42 |

Unicorns

43 |

All the things

44 |
45 | ``` 46 | 47 | If you want code syntax highlighted, use GitHub Flavored Markdown rendered from [GitHub's `/markdown` API](https://developer.github.com/v3/markdown/). 48 | 49 | 50 | ## How 51 | 52 | See [`generate-github-markdown-css`](https://github.com/sindresorhus/generate-github-markdown-css) for how it's generated and ability to generate your own. 53 | 54 | 55 | ## Dev 56 | 57 | Run `npm run make` to update the CSS. 58 | 59 | 60 | ## License 61 | 62 | MIT © [Sindre Sorhus](https://sindresorhus.com) 63 | -------------------------------------------------------------------------------- /github-markdown.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: octicons-link; 3 | src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); 4 | } 5 | 6 | .markdown-body .octicon { 7 | display: inline-block; 8 | fill: currentColor; 9 | vertical-align: text-bottom; 10 | } 11 | 12 | .markdown-body .anchor { 13 | float: left; 14 | line-height: 1; 15 | margin-left: -20px; 16 | padding-right: 4px; 17 | } 18 | 19 | .markdown-body .anchor:focus { 20 | outline: none; 21 | } 22 | 23 | .markdown-body h1 .octicon-link, 24 | .markdown-body h2 .octicon-link, 25 | .markdown-body h3 .octicon-link, 26 | .markdown-body h4 .octicon-link, 27 | .markdown-body h5 .octicon-link, 28 | .markdown-body h6 .octicon-link { 29 | color: #1b1f23; 30 | vertical-align: middle; 31 | visibility: hidden; 32 | } 33 | 34 | .markdown-body h1:hover .anchor, 35 | .markdown-body h2:hover .anchor, 36 | .markdown-body h3:hover .anchor, 37 | .markdown-body h4:hover .anchor, 38 | .markdown-body h5:hover .anchor, 39 | .markdown-body h6:hover .anchor { 40 | text-decoration: none; 41 | } 42 | 43 | .markdown-body h1:hover .anchor .octicon-link, 44 | .markdown-body h2:hover .anchor .octicon-link, 45 | .markdown-body h3:hover .anchor .octicon-link, 46 | .markdown-body h4:hover .anchor .octicon-link, 47 | .markdown-body h5:hover .anchor .octicon-link, 48 | .markdown-body h6:hover .anchor .octicon-link { 49 | visibility: visible; 50 | } 51 | 52 | .markdown-body { 53 | -ms-text-size-adjust: 100%; 54 | -webkit-text-size-adjust: 100%; 55 | color: #24292e; 56 | line-height: 1.5; 57 | font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; 58 | font-size: 16px; 59 | line-height: 1.5; 60 | word-wrap: break-word; 61 | } 62 | 63 | .markdown-body .pl-c { 64 | color: #6a737d; 65 | } 66 | 67 | .markdown-body .pl-c1, 68 | .markdown-body .pl-s .pl-v { 69 | color: #005cc5; 70 | } 71 | 72 | .markdown-body .pl-e, 73 | .markdown-body .pl-en { 74 | color: #6f42c1; 75 | } 76 | 77 | .markdown-body .pl-s .pl-s1, 78 | .markdown-body .pl-smi { 79 | color: #24292e; 80 | } 81 | 82 | .markdown-body .pl-ent { 83 | color: #22863a; 84 | } 85 | 86 | .markdown-body .pl-k { 87 | color: #d73a49; 88 | } 89 | 90 | .markdown-body .pl-pds, 91 | .markdown-body .pl-s, 92 | .markdown-body .pl-s .pl-pse .pl-s1, 93 | .markdown-body .pl-sr, 94 | .markdown-body .pl-sr .pl-cce, 95 | .markdown-body .pl-sr .pl-sra, 96 | .markdown-body .pl-sr .pl-sre { 97 | color: #032f62; 98 | } 99 | 100 | .markdown-body .pl-smw, 101 | .markdown-body .pl-v { 102 | color: #e36209; 103 | } 104 | 105 | .markdown-body .pl-bu { 106 | color: #b31d28; 107 | } 108 | 109 | .markdown-body .pl-ii { 110 | background-color: #b31d28; 111 | color: #fafbfc; 112 | } 113 | 114 | .markdown-body .pl-c2 { 115 | background-color: #d73a49; 116 | color: #fafbfc; 117 | } 118 | 119 | .markdown-body .pl-c2:before { 120 | content: "^M"; 121 | } 122 | 123 | .markdown-body .pl-sr .pl-cce { 124 | color: #22863a; 125 | font-weight: 700; 126 | } 127 | 128 | .markdown-body .pl-ml { 129 | color: #735c0f; 130 | } 131 | 132 | .markdown-body .pl-mh, 133 | .markdown-body .pl-mh .pl-en, 134 | .markdown-body .pl-ms { 135 | color: #005cc5; 136 | font-weight: 700; 137 | } 138 | 139 | .markdown-body .pl-mi { 140 | color: #24292e; 141 | font-style: italic; 142 | } 143 | 144 | .markdown-body .pl-mb { 145 | color: #24292e; 146 | font-weight: 700; 147 | } 148 | 149 | .markdown-body .pl-md { 150 | background-color: #ffeef0; 151 | color: #b31d28; 152 | } 153 | 154 | .markdown-body .pl-mi1 { 155 | background-color: #f0fff4; 156 | color: #22863a; 157 | } 158 | 159 | .markdown-body .pl-mc { 160 | background-color: #ffebda; 161 | color: #e36209; 162 | } 163 | 164 | .markdown-body .pl-mi2 { 165 | background-color: #005cc5; 166 | color: #f6f8fa; 167 | } 168 | 169 | .markdown-body .pl-mdr { 170 | color: #6f42c1; 171 | font-weight: 700; 172 | } 173 | 174 | .markdown-body .pl-ba { 175 | color: #586069; 176 | } 177 | 178 | .markdown-body .pl-sg { 179 | color: #959da5; 180 | } 181 | 182 | .markdown-body .pl-corl { 183 | color: #032f62; 184 | text-decoration: underline; 185 | } 186 | 187 | .markdown-body details { 188 | display: block; 189 | } 190 | 191 | .markdown-body summary { 192 | display: list-item; 193 | } 194 | 195 | .markdown-body a { 196 | background-color: transparent; 197 | } 198 | 199 | .markdown-body a:active, 200 | .markdown-body a:hover { 201 | outline-width: 0; 202 | } 203 | 204 | .markdown-body strong { 205 | font-weight: inherit; 206 | font-weight: bolder; 207 | } 208 | 209 | .markdown-body h1 { 210 | font-size: 2em; 211 | margin: .67em 0; 212 | } 213 | 214 | .markdown-body img { 215 | border-style: none; 216 | } 217 | 218 | .markdown-body code, 219 | .markdown-body kbd, 220 | .markdown-body pre { 221 | font-family: monospace,monospace; 222 | font-size: 1em; 223 | } 224 | 225 | .markdown-body hr { 226 | box-sizing: content-box; 227 | height: 0; 228 | overflow: visible; 229 | } 230 | 231 | .markdown-body input { 232 | font: inherit; 233 | margin: 0; 234 | } 235 | 236 | .markdown-body input { 237 | overflow: visible; 238 | } 239 | 240 | .markdown-body [type=checkbox] { 241 | box-sizing: border-box; 242 | padding: 0; 243 | } 244 | 245 | .markdown-body * { 246 | box-sizing: border-box; 247 | } 248 | 249 | .markdown-body input { 250 | font-family: inherit; 251 | font-size: inherit; 252 | line-height: inherit; 253 | } 254 | 255 | .markdown-body a { 256 | color: #0366d6; 257 | text-decoration: none; 258 | } 259 | 260 | .markdown-body a:hover { 261 | text-decoration: underline; 262 | } 263 | 264 | .markdown-body strong { 265 | font-weight: 600; 266 | } 267 | 268 | .markdown-body hr { 269 | background: transparent; 270 | border: 0; 271 | border-bottom: 1px solid #dfe2e5; 272 | height: 0; 273 | margin: 15px 0; 274 | overflow: hidden; 275 | } 276 | 277 | .markdown-body hr:before { 278 | content: ""; 279 | display: table; 280 | } 281 | 282 | .markdown-body hr:after { 283 | clear: both; 284 | content: ""; 285 | display: table; 286 | } 287 | 288 | .markdown-body table { 289 | border-collapse: collapse; 290 | border-spacing: 0; 291 | } 292 | 293 | .markdown-body td, 294 | .markdown-body th { 295 | padding: 0; 296 | } 297 | 298 | .markdown-body details summary { 299 | cursor: pointer; 300 | } 301 | 302 | .markdown-body h1, 303 | .markdown-body h2, 304 | .markdown-body h3, 305 | .markdown-body h4, 306 | .markdown-body h5, 307 | .markdown-body h6 { 308 | margin-bottom: 0; 309 | margin-top: 0; 310 | } 311 | 312 | .markdown-body h1 { 313 | font-size: 32px; 314 | } 315 | 316 | .markdown-body h1, 317 | .markdown-body h2 { 318 | font-weight: 600; 319 | } 320 | 321 | .markdown-body h2 { 322 | font-size: 24px; 323 | } 324 | 325 | .markdown-body h3 { 326 | font-size: 20px; 327 | } 328 | 329 | .markdown-body h3, 330 | .markdown-body h4 { 331 | font-weight: 600; 332 | } 333 | 334 | .markdown-body h4 { 335 | font-size: 16px; 336 | } 337 | 338 | .markdown-body h5 { 339 | font-size: 14px; 340 | } 341 | 342 | .markdown-body h5, 343 | .markdown-body h6 { 344 | font-weight: 600; 345 | } 346 | 347 | .markdown-body h6 { 348 | font-size: 12px; 349 | } 350 | 351 | .markdown-body p { 352 | margin-bottom: 10px; 353 | margin-top: 0; 354 | } 355 | 356 | .markdown-body blockquote { 357 | margin: 0; 358 | } 359 | 360 | .markdown-body ol, 361 | .markdown-body ul { 362 | margin-bottom: 0; 363 | margin-top: 0; 364 | padding-left: 0; 365 | } 366 | 367 | .markdown-body ol ol, 368 | .markdown-body ul ol { 369 | list-style-type: lower-roman; 370 | } 371 | 372 | .markdown-body ol ol ol, 373 | .markdown-body ol ul ol, 374 | .markdown-body ul ol ol, 375 | .markdown-body ul ul ol { 376 | list-style-type: lower-alpha; 377 | } 378 | 379 | .markdown-body dd { 380 | margin-left: 0; 381 | } 382 | 383 | .markdown-body code, 384 | .markdown-body pre { 385 | font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; 386 | font-size: 12px; 387 | } 388 | 389 | .markdown-body pre { 390 | margin-bottom: 0; 391 | margin-top: 0; 392 | } 393 | 394 | .markdown-body input::-webkit-inner-spin-button, 395 | .markdown-body input::-webkit-outer-spin-button { 396 | -webkit-appearance: none; 397 | appearance: none; 398 | margin: 0; 399 | } 400 | 401 | .markdown-body .border { 402 | border: 1px solid #e1e4e8!important; 403 | } 404 | 405 | .markdown-body .border-0 { 406 | border: 0!important; 407 | } 408 | 409 | .markdown-body .border-bottom { 410 | border-bottom: 1px solid #e1e4e8!important; 411 | } 412 | 413 | .markdown-body .rounded-1 { 414 | border-radius: 3px!important; 415 | } 416 | 417 | .markdown-body .bg-white { 418 | background-color: #fff!important; 419 | } 420 | 421 | .markdown-body .bg-gray-light { 422 | background-color: #fafbfc!important; 423 | } 424 | 425 | .markdown-body .text-gray-light { 426 | color: #6a737d!important; 427 | } 428 | 429 | .markdown-body .mb-0 { 430 | margin-bottom: 0!important; 431 | } 432 | 433 | .markdown-body .my-2 { 434 | margin-bottom: 8px!important; 435 | margin-top: 8px!important; 436 | } 437 | 438 | .markdown-body .pl-0 { 439 | padding-left: 0!important; 440 | } 441 | 442 | .markdown-body .py-0 { 443 | padding-bottom: 0!important; 444 | padding-top: 0!important; 445 | } 446 | 447 | .markdown-body .pl-1 { 448 | padding-left: 4px!important; 449 | } 450 | 451 | .markdown-body .pl-2 { 452 | padding-left: 8px!important; 453 | } 454 | 455 | .markdown-body .py-2 { 456 | padding-bottom: 8px!important; 457 | padding-top: 8px!important; 458 | } 459 | 460 | .markdown-body .pl-3, 461 | .markdown-body .px-3 { 462 | padding-left: 16px!important; 463 | } 464 | 465 | .markdown-body .px-3 { 466 | padding-right: 16px!important; 467 | } 468 | 469 | .markdown-body .pl-4 { 470 | padding-left: 24px!important; 471 | } 472 | 473 | .markdown-body .pl-5 { 474 | padding-left: 32px!important; 475 | } 476 | 477 | .markdown-body .pl-6 { 478 | padding-left: 40px!important; 479 | } 480 | 481 | .markdown-body .f6 { 482 | font-size: 12px!important; 483 | } 484 | 485 | .markdown-body .lh-condensed { 486 | line-height: 1.25!important; 487 | } 488 | 489 | .markdown-body .text-bold { 490 | font-weight: 600!important; 491 | } 492 | 493 | .markdown-body:before { 494 | content: ""; 495 | display: table; 496 | } 497 | 498 | .markdown-body:after { 499 | clear: both; 500 | content: ""; 501 | display: table; 502 | } 503 | 504 | .markdown-body>:first-child { 505 | margin-top: 0!important; 506 | } 507 | 508 | .markdown-body>:last-child { 509 | margin-bottom: 0!important; 510 | } 511 | 512 | .markdown-body a:not([href]) { 513 | color: inherit; 514 | text-decoration: none; 515 | } 516 | 517 | .markdown-body blockquote, 518 | .markdown-body dl, 519 | .markdown-body ol, 520 | .markdown-body p, 521 | .markdown-body pre, 522 | .markdown-body table, 523 | .markdown-body ul { 524 | margin-bottom: 16px; 525 | margin-top: 0; 526 | } 527 | 528 | .markdown-body hr { 529 | background-color: #e1e4e8; 530 | border: 0; 531 | height: .25em; 532 | margin: 24px 0; 533 | padding: 0; 534 | } 535 | 536 | .markdown-body blockquote { 537 | border-left: .25em solid #dfe2e5; 538 | color: #6a737d; 539 | padding: 0 1em; 540 | } 541 | 542 | .markdown-body blockquote>:first-child { 543 | margin-top: 0; 544 | } 545 | 546 | .markdown-body blockquote>:last-child { 547 | margin-bottom: 0; 548 | } 549 | 550 | .markdown-body kbd { 551 | background-color: #fafbfc; 552 | border: 1px solid #c6cbd1; 553 | border-bottom-color: #959da5; 554 | border-radius: 3px; 555 | box-shadow: inset 0 -1px 0 #959da5; 556 | color: #444d56; 557 | display: inline-block; 558 | font-size: 11px; 559 | line-height: 10px; 560 | padding: 3px 5px; 561 | vertical-align: middle; 562 | } 563 | 564 | .markdown-body h1, 565 | .markdown-body h2, 566 | .markdown-body h3, 567 | .markdown-body h4, 568 | .markdown-body h5, 569 | .markdown-body h6 { 570 | font-weight: 600; 571 | line-height: 1.25; 572 | margin-bottom: 16px; 573 | margin-top: 24px; 574 | } 575 | 576 | .markdown-body h1 { 577 | font-size: 2em; 578 | } 579 | 580 | .markdown-body h1, 581 | .markdown-body h2 { 582 | border-bottom: 1px solid #eaecef; 583 | padding-bottom: .3em; 584 | } 585 | 586 | .markdown-body h2 { 587 | font-size: 1.5em; 588 | } 589 | 590 | .markdown-body h3 { 591 | font-size: 1.25em; 592 | } 593 | 594 | .markdown-body h4 { 595 | font-size: 1em; 596 | } 597 | 598 | .markdown-body h5 { 599 | font-size: .875em; 600 | } 601 | 602 | .markdown-body h6 { 603 | color: #6a737d; 604 | font-size: .85em; 605 | } 606 | 607 | .markdown-body ol, 608 | .markdown-body ul { 609 | padding-left: 2em; 610 | } 611 | 612 | .markdown-body ol ol, 613 | .markdown-body ol ul, 614 | .markdown-body ul ol, 615 | .markdown-body ul ul { 616 | margin-bottom: 0; 617 | margin-top: 0; 618 | } 619 | 620 | .markdown-body li { 621 | word-wrap: break-all; 622 | } 623 | 624 | .markdown-body li>p { 625 | margin-top: 16px; 626 | } 627 | 628 | .markdown-body li+li { 629 | margin-top: .25em; 630 | } 631 | 632 | .markdown-body dl { 633 | padding: 0; 634 | } 635 | 636 | .markdown-body dl dt { 637 | font-size: 1em; 638 | font-style: italic; 639 | font-weight: 600; 640 | margin-top: 16px; 641 | padding: 0; 642 | } 643 | 644 | .markdown-body dl dd { 645 | margin-bottom: 16px; 646 | padding: 0 16px; 647 | } 648 | 649 | .markdown-body table { 650 | display: block; 651 | overflow: auto; 652 | width: 100%; 653 | } 654 | 655 | .markdown-body table th { 656 | font-weight: 600; 657 | } 658 | 659 | .markdown-body table td, 660 | .markdown-body table th { 661 | border: 1px solid #dfe2e5; 662 | padding: 6px 13px; 663 | } 664 | 665 | .markdown-body table tr { 666 | background-color: #fff; 667 | border-top: 1px solid #c6cbd1; 668 | } 669 | 670 | .markdown-body table tr:nth-child(2n) { 671 | background-color: #f6f8fa; 672 | } 673 | 674 | .markdown-body img { 675 | background-color: #fff; 676 | box-sizing: content-box; 677 | max-width: 100%; 678 | } 679 | 680 | .markdown-body img[align=right] { 681 | padding-left: 20px; 682 | } 683 | 684 | .markdown-body img[align=left] { 685 | padding-right: 20px; 686 | } 687 | 688 | .markdown-body code { 689 | background-color: rgba(27,31,35,.05); 690 | border-radius: 3px; 691 | font-size: 85%; 692 | margin: 0; 693 | padding: .2em .4em; 694 | } 695 | 696 | .markdown-body pre { 697 | word-wrap: normal; 698 | } 699 | 700 | .markdown-body pre>code { 701 | background: transparent; 702 | border: 0; 703 | font-size: 100%; 704 | margin: 0; 705 | padding: 0; 706 | white-space: pre; 707 | word-break: normal; 708 | } 709 | 710 | .markdown-body .highlight { 711 | margin-bottom: 16px; 712 | } 713 | 714 | .markdown-body .highlight pre { 715 | margin-bottom: 0; 716 | word-break: normal; 717 | } 718 | 719 | .markdown-body .highlight pre, 720 | .markdown-body pre { 721 | background-color: #f6f8fa; 722 | border-radius: 3px; 723 | font-size: 85%; 724 | line-height: 1.45; 725 | overflow: auto; 726 | padding: 16px; 727 | } 728 | 729 | .markdown-body pre code { 730 | background-color: transparent; 731 | border: 0; 732 | display: inline; 733 | line-height: inherit; 734 | margin: 0; 735 | max-width: auto; 736 | overflow: visible; 737 | padding: 0; 738 | word-wrap: normal; 739 | } 740 | 741 | .markdown-body .commit-tease-sha { 742 | color: #444d56; 743 | display: inline-block; 744 | font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; 745 | font-size: 90%; 746 | } 747 | 748 | .markdown-body .blob-wrapper { 749 | border-bottom-left-radius: 3px; 750 | border-bottom-right-radius: 3px; 751 | overflow-x: auto; 752 | overflow-y: hidden; 753 | } 754 | 755 | .markdown-body .blob-wrapper-embedded { 756 | max-height: 240px; 757 | overflow-y: auto; 758 | } 759 | 760 | .markdown-body .blob-num { 761 | -moz-user-select: none; 762 | -ms-user-select: none; 763 | -webkit-user-select: none; 764 | color: rgba(27,31,35,.3); 765 | cursor: pointer; 766 | font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; 767 | font-size: 12px; 768 | line-height: 20px; 769 | min-width: 50px; 770 | padding-left: 10px; 771 | padding-right: 10px; 772 | text-align: right; 773 | user-select: none; 774 | vertical-align: top; 775 | white-space: nowrap; 776 | width: 1%; 777 | } 778 | 779 | .markdown-body .blob-num:hover { 780 | color: rgba(27,31,35,.6); 781 | } 782 | 783 | .markdown-body .blob-num:before { 784 | content: attr(data-line-number); 785 | } 786 | 787 | .markdown-body .blob-code { 788 | line-height: 20px; 789 | padding-left: 10px; 790 | padding-right: 10px; 791 | position: relative; 792 | vertical-align: top; 793 | } 794 | 795 | .markdown-body .blob-code-inner { 796 | color: #24292e; 797 | font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; 798 | font-size: 12px; 799 | overflow: visible; 800 | white-space: pre; 801 | word-wrap: normal; 802 | } 803 | 804 | .markdown-body .pl-token.active, 805 | .markdown-body .pl-token:hover { 806 | background: #ffea7f; 807 | cursor: pointer; 808 | } 809 | 810 | .markdown-body kbd { 811 | background-color: #fafbfc; 812 | border: 1px solid #d1d5da; 813 | border-bottom-color: #c6cbd1; 814 | border-radius: 3px; 815 | box-shadow: inset 0 -1px 0 #c6cbd1; 816 | color: #444d56; 817 | display: inline-block; 818 | font: 11px SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; 819 | line-height: 10px; 820 | padding: 3px 5px; 821 | vertical-align: middle; 822 | } 823 | 824 | .markdown-body :checked+.radio-label { 825 | border-color: #0366d6; 826 | position: relative; 827 | z-index: 1; 828 | } 829 | 830 | .markdown-body .tab-size[data-tab-size="1"] { 831 | -moz-tab-size: 1; 832 | tab-size: 1; 833 | } 834 | 835 | .markdown-body .tab-size[data-tab-size="2"] { 836 | -moz-tab-size: 2; 837 | tab-size: 2; 838 | } 839 | 840 | .markdown-body .tab-size[data-tab-size="3"] { 841 | -moz-tab-size: 3; 842 | tab-size: 3; 843 | } 844 | 845 | .markdown-body .tab-size[data-tab-size="4"] { 846 | -moz-tab-size: 4; 847 | tab-size: 4; 848 | } 849 | 850 | .markdown-body .tab-size[data-tab-size="5"] { 851 | -moz-tab-size: 5; 852 | tab-size: 5; 853 | } 854 | 855 | .markdown-body .tab-size[data-tab-size="6"] { 856 | -moz-tab-size: 6; 857 | tab-size: 6; 858 | } 859 | 860 | .markdown-body .tab-size[data-tab-size="7"] { 861 | -moz-tab-size: 7; 862 | tab-size: 7; 863 | } 864 | 865 | .markdown-body .tab-size[data-tab-size="8"] { 866 | -moz-tab-size: 8; 867 | tab-size: 8; 868 | } 869 | 870 | .markdown-body .tab-size[data-tab-size="9"] { 871 | -moz-tab-size: 9; 872 | tab-size: 9; 873 | } 874 | 875 | .markdown-body .tab-size[data-tab-size="10"] { 876 | -moz-tab-size: 10; 877 | tab-size: 10; 878 | } 879 | 880 | .markdown-body .tab-size[data-tab-size="11"] { 881 | -moz-tab-size: 11; 882 | tab-size: 11; 883 | } 884 | 885 | .markdown-body .tab-size[data-tab-size="12"] { 886 | -moz-tab-size: 12; 887 | tab-size: 12; 888 | } 889 | 890 | .markdown-body .task-list-item { 891 | list-style-type: none; 892 | } 893 | 894 | .markdown-body .task-list-item+.task-list-item { 895 | margin-top: 3px; 896 | } 897 | 898 | .markdown-body .task-list-item input { 899 | margin: 0 .2em .25em -1.6em; 900 | vertical-align: middle; 901 | } 902 | 903 | .markdown-body hr { 904 | border-bottom-color: #eee; 905 | } 906 | 907 | .markdown-body .pl-0 { 908 | padding-left: 0!important; 909 | } 910 | 911 | .markdown-body .pl-1 { 912 | padding-left: 4px!important; 913 | } 914 | 915 | .markdown-body .pl-2 { 916 | padding-left: 8px!important; 917 | } 918 | 919 | .markdown-body .pl-3 { 920 | padding-left: 16px!important; 921 | } 922 | 923 | .markdown-body .pl-4 { 924 | padding-left: 24px!important; 925 | } 926 | 927 | .markdown-body .pl-5 { 928 | padding-left: 32px!important; 929 | } 930 | 931 | .markdown-body .pl-6 { 932 | padding-left: 40px!important; 933 | } 934 | 935 | .markdown-body .pl-7 { 936 | padding-left: 48px!important; 937 | } 938 | 939 | .markdown-body .pl-8 { 940 | padding-left: 64px!important; 941 | } 942 | 943 | .markdown-body .pl-9 { 944 | padding-left: 80px!important; 945 | } 946 | 947 | .markdown-body .pl-10 { 948 | padding-left: 96px!important; 949 | } 950 | 951 | .markdown-body .pl-11 { 952 | padding-left: 112px!important; 953 | } 954 | 955 | .markdown-body .pl-12 { 956 | padding-left: 128px!important; 957 | } 958 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GitHub Markdown CSS demo 7 | 8 | 17 | 18 | 19 |
20 |

GitHub Markdown CSS demo

21 | 22 |

23 | 24 |

Headers

25 | 26 |
# H1
  27 | ## H2
  28 | ### H3
  29 | #### H4
  30 | ##### H5
  31 | ###### H6
  32 | 
  33 | Alternatively, for H1 and H2, an underline-ish style:
  34 | 
  35 | Alt-H1
  36 | ======
  37 | 
  38 | Alt-H2
  39 | ------
  40 | 
41 | 42 |

H1

43 | 44 |

H2

45 | 46 |

H3

47 | 48 |

H4

49 | 50 |
H5
51 | 52 |
H6
53 | 54 |

Alternatively, for H1 and H2, an underline-ish style:

55 | 56 |

Alt-H1

57 | 58 |

Alt-H2

59 | 60 |

61 | 62 |

Emphasis

63 | 64 |
Emphasis, aka italics, with *asterisks* or _underscores_.
  65 | 
  66 | Strong emphasis, aka bold, with **asterisks** or __underscores__.
  67 | 
  68 | Combined emphasis with **asterisks and _underscores_**.
  69 | 
  70 | Strikethrough uses two tildes. ~~Scratch this.~~
  71 | 
72 | 73 |

Emphasis, aka italics, with asterisks or underscores.

74 | 75 |

Strong emphasis, aka bold, with asterisks or underscores.

76 | 77 |

Combined emphasis with asterisks and underscores.

78 | 79 |

Strikethrough uses two tildes. Scratch this.

80 | 81 |

82 | 83 |

Lists

84 | 85 |

(In this example, leading and trailing spaces are shown with with dots: ⋅)

86 | 87 |
1. First ordered list item
  88 | 2. Another item
  89 | ⋅⋅* Unordered sub-list.
  90 | 1. Actual numbers don't matter, just that it's a number
  91 | ⋅⋅1. Ordered sub-list
  92 | 4. And another item.
  93 | 
  94 | ⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
  95 | 
  96 | ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
  97 | ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
  98 | ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
  99 | 
 100 | * Unordered list can use asterisks
 101 | - Or minuses
 102 | + Or pluses
 103 | 
104 | 105 |
    106 |
  1. First ordered list item
  2. 107 |
  3. Another item 108 | 109 |
      110 |
    • Unordered sub-list.
    • 111 |
  4. 112 |
  5. Actual numbers don't matter, just that it's a number 113 | 114 |
      115 |
    1. Ordered sub-list
    2. 116 |
  6. 117 |
  7. And another item.

    118 | 119 |

    You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).

    120 | 121 |

    To have a line break without a paragraph, you will need to use two trailing spaces. 122 | Note that this line is separate, but within the same paragraph. 123 | (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)

  8. 124 |
125 | 126 | 131 | 132 |
    133 |
  1. foo 134 | 135 |
      136 |
    1. bar 137 | 138 |
        139 |
      1. baz 140 | 141 |
          142 |
        1. faz
        2. 143 |
      2. 144 |
    2. 145 |
  2. 146 |
  3. foo2

  4. 147 |
148 | 149 | 165 | 166 |
    167 |
  1. foo

    168 | 169 |
      170 |
    • bar 171 | 172 |
        173 |
      1. baz 174 | 175 |
          176 |
        • faz
        • 177 |
      2. 178 |
    • 179 |
  2. 180 |
181 | 182 | 197 | 198 |
    199 |
  1. Lists in a list item: 200 | 201 |
      202 |
    • Indented four spaces. 203 | 204 |
        205 |
      • indented eight spaces.
      • 206 |
    • 207 |
    • Four spaces again.
    • 208 |
  2. 209 |
  3. Multiple paragraphs in a list items: 210 | It's best to indent the paragraphs four spaces 211 | You can get away with three, but it can get 212 | confusing when you nest other things. 213 | Stick to four.

    214 | 215 |

    We indented the first line an extra space to align 216 | it with these paragraphs. In real use, we might do 217 | that to the entire list so that all items line up.

    218 | 219 |

    This paragraph is still part of the list item, but it looks messy to humans. So it's a good idea to wrap your nested paragraphs manually, as we did with the first two.

  4. 220 |
  5. Blockquotes in a list item:

    221 | 222 |
    223 |

    Skip a line and 224 | indent the >'s four spaces.

    225 |
  6. 226 |
  7. Preformatted text in a list item:

    227 | 228 |
    Skip a line and indent eight spaces.
     229 | That's four spaces for the list
     230 | and four to trigger the code block.
     231 | 
  8. 232 |
233 | 234 |

Inline HTML

235 | 236 |

To reboot your computer, press ctrl+alt+del.

237 | 238 |

239 | 240 |

Links

241 | 242 |

There are two ways to create links.

243 | 244 |
[I'm an inline-style link](https://www.google.com)
 245 | 
 246 | [I'm an inline-style link with title](https://www.google.com "Google's Homepage")
 247 | 
 248 | [I'm a reference-style link][Arbitrary case-insensitive reference text]
 249 | 
 250 | [I'm a relative reference to a repository file](../blob/master/LICENSE)
 251 | 
 252 | [You can use numbers for reference-style link definitions][1]
 253 | 
 254 | Or leave it empty and use the [link text itself]
 255 | 
 256 | Some text to show that the reference links can follow later.
 257 | 
 258 | [arbitrary case-insensitive reference text]: https://www.mozilla.org
 259 | [1]: http://slashdot.org
 260 | [link text itself]: http://www.reddit.com
 261 | 
262 | 263 |

I'm an inline-style link

264 | 265 |

I'm an inline-style link with title

266 | 267 |

I'm a reference-style link

268 | 269 |

I'm a relative reference to a repository file

270 | 271 |

You can use numbers for reference-style link definitions

272 | 273 |

Or leave it empty and use the link text itself

274 | 275 |

Some text to show that the reference links can follow later.

276 | 277 |

278 | 279 |

Images

280 | 281 |
Here's our logo (hover to see the title text):
 282 | 
 283 | Inline-style:
 284 | ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
 285 | 
 286 | Reference-style:
 287 | ![alt text][logo]
 288 | 
 289 | [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
 290 | 
291 | 292 |

Here's our logo (hover to see the title text):

293 | 294 |

Inline-style: 295 | alt text

296 | 297 |

Reference-style: 298 | alt text

299 | 300 |

301 | 302 |

Code and Syntax Highlighting

303 | 304 |

Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and Markdown Here -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the highlight.js demo page.

305 | 306 |
Inline `code` has `back-ticks around` it.
 307 | 
308 | 309 |

Inline code has back-ticks around it.

310 | 311 |

Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.

312 | 313 |
```javascript
 314 | var s = "JavaScript syntax highlighting";
 315 | alert(s);
 316 | ```
 317 | 
 318 | ```python
 319 | s = "Python syntax highlighting"
 320 | print s
 321 | ```
 322 | 
 323 | ```
 324 | No language indicated, so no syntax highlighting.
 325 | But let's throw in a <b>tag</b>.
 326 | ```
 327 | 
328 | 329 |
var s = "JavaScript syntax highlighting";
 330 | alert(s);
331 | 332 |
s = "Python syntax highlighting"
 333 | print s
334 | 335 |
No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
 336 | But let's throw in a <b>tag</b>.
 337 | 
338 | 339 |

340 | 341 |

Tables

342 | 343 |

Tables aren't part of the core Markdown spec, but they are part of GFM and Markdown Here supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.

344 | 345 |
Colons can be used to align columns.
 346 | 
 347 | | Tables        | Are           | Cool  |
 348 | | ------------- |:-------------:| -----:|
 349 | | col 3 is      | right-aligned |  |
 350 | | col 2 is      | centered      |    |
 351 | | zebra stripes | are neat      |     |
 352 | 
 353 | The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
 354 | 
 355 | Markdown | Less | Pretty
 356 | --- | --- | ---
 357 | *Still* | `renders` | **nicely**
 358 | 1 | 2 | 3
 359 | 
360 | 361 |

Colons can be used to align columns.

362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 |
TablesAreCool
col 3 isright-aligned
col 2 iscentered
zebra stripesare neat
386 | 387 |

The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.

388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 |
MarkdownLessPretty
Stillrendersnicely
123
407 | 408 |

409 | 410 |

Blockquotes

411 | 412 |
> Blockquotes are very handy in email to emulate reply text.
 413 | > This line is part of the same quote.
 414 | 
 415 | Quote break.
 416 | 
 417 | > This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
 418 | 
419 | 420 |
421 |

Blockquotes are very handy in email to emulate reply text. 422 | This line is part of the same quote.

423 |
424 | 425 |

Quote break.

426 | 427 |
428 |

This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

429 |
430 | 431 |

432 | 433 |

Inline HTML

434 | 435 |

You can also use raw HTML in your Markdown, and it'll mostly work pretty well.

436 | 437 |
<dl>
 438 |     <dt>Definition list</dt>
 439 |     <dd>Is something people use sometimes.</dd>
 440 | 
 441 |     <dt>Markdown in HTML</dt>
 442 |     <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
 443 | </dl>
 444 | 
445 | 446 |
447 |
Definition list
448 |
Is something people use sometimes.
449 | 450 |
Markdown in HTML
451 |
Does *not* work **very** well. Use HTML tags.
452 |
453 | 454 |

455 | 456 |

Horizontal Rule

457 | 458 |
Three or more...
 459 | 
 460 | ---
 461 | 
 462 | Hyphens
 463 | 
 464 | ***
 465 | 
 466 | Asterisks
 467 | 
 468 | ___
 469 | 
 470 | Underscores
 471 | 
472 | 473 |

Three or more...

474 | 475 |
476 | 477 |

Hyphens

478 | 479 |
480 | 481 |

Asterisks

482 | 483 |
484 | 485 |

Underscores

486 | 487 |

488 | 489 |

Line Breaks

490 | 491 |

My basic recommendation for learning how line breaks work is to experiment and discover -- hit <Enter> once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.

492 | 493 |

Here are some things to try out:

494 | 495 |
Here's a line for us to start with.
 496 | 
 497 | This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
 498 | 
 499 | This line is also a separate paragraph, but...
 500 | This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
 501 | 
502 | 503 |

Here's a line for us to start with.

504 | 505 |

This line is separated from the one above by two newlines, so it will be a separate paragraph.

506 | 507 |

This line is also begins a separate paragraph, but... 508 | This line is only separated by a single newline, so it's a separate line in the same paragraph.

509 | 510 |

(Technical note: Markdown Here uses GFM line breaks, so there's no need to use MD's two-space line breaks.)

511 | 512 |

513 | 514 |

Youtube videos

515 | 516 |

They can't be added directly but you can add an image with a link to the video like this:

517 | 518 |
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
 519 | " target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
 520 | alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
 521 | 
522 | 523 |

Or, in pure Markdown, but losing the image sizing and border:

524 | 525 |
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
 526 | 
527 | 528 |

Referencing a bug by #bugID in your git commit links it to the slip. For example #1.

529 | 530 |

Task List

531 | 532 | 541 | 542 |

[test]: http://google.com/ "Google"

543 | 544 |

A heading

545 | 546 |

Just a note, I've found that I can't test my markdown parser vs others. 547 | For example, both markdown.js and showdown code blocks in lists wrong. They're 548 | also completely [inconsistent][test] with regards to paragraphs in list items.

549 | 550 |

A link. Not anymore.

551 | 552 |

This will make me fail the test because 553 | markdown.js doesnt acknowledge arbitrary html blocks =/

554 | 555 | 574 | 575 |

Paragraph.

576 | 577 |
578 |
    579 |
  • bq Item 1
  • 580 |
  • bq Item 2 581 | 582 |
      583 |
    • New bq Item 1
    • 584 |
    • New bq Item 2 585 | Text here
    • 586 |
  • 587 |
588 |
589 | 590 |
591 | 592 |
593 |

Another blockquote! 594 | I really need to get 595 | more creative with 596 | mockup text.. 597 | markdown.js breaks here again

598 |
599 | 600 |

Another Heading

601 | 602 |

Hello world. Here is a link. 603 | And an image alt.

604 | 605 |
Code goes here.
 606 | Lots of it...
 607 | 
608 | 609 |
610 |

A list within a blockquote:

611 | 612 |
    613 |
  • asterisk 1
  • 614 |
  • asterisk 2
  • 615 |
  • asterisk 3
  • 616 |
617 |
618 | 619 |

This is strong and em.

620 | 621 |

So is this word.

622 | 623 |

This is strong and em.

624 | 625 |

So is this word.

626 | 627 |

Unordered

628 | 629 |

Asterisks tight:

630 | 631 | 636 | 637 |

Asterisks loose:

638 | 639 | 644 | 645 |
646 | 647 |

Pluses tight:

648 | 649 | 654 | 655 |

Pluses loose:

656 | 657 | 662 | 663 |
664 | 665 |

Minuses tight:

666 | 667 | 672 | 673 |

Minuses loose:

674 | 675 | 680 | 681 |

Ordered

682 | 683 |

Tight:

684 | 685 |
    686 |
  1. First
  2. 687 |
  3. Second
  4. 688 |
  5. Third
  6. 689 |
690 | 691 |

and:

692 | 693 |
    694 |
  1. One
  2. 695 |
  3. Two
  4. 696 |
  5. Three
  6. 697 |
698 | 699 |

Loose using tabs:

700 | 701 |
    702 |
  1. First

  2. 703 |
  3. Second

  4. 704 |
  5. Third

  6. 705 |
706 | 707 |

and using spaces:

708 | 709 |
    710 |
  1. One

  2. 711 |
  3. Two

  4. 712 |
  5. Three

  6. 713 |
714 | 715 |

Multiple paragraphs:

716 | 717 |
    718 |
  1. Item 1, graf one.

    719 | 720 |

    Item 2. graf two. The quick brown fox jumped over the lazy dog's 721 | back.

  2. 722 |
  3. Item 2.

  4. 723 |
  5. Item 3.

  6. 724 |
725 | 726 |

Nested

727 | 728 | 739 | 740 |

Here's another:

741 | 742 |
    743 |
  1. First
  2. 744 |
  3. Second: 745 | 746 |
      747 |
    • Fee
    • 748 |
    • Fie
    • 749 |
    • Foe
    • 750 |
  4. 751 |
  5. Third
  6. 752 |
753 | 754 |

Same thing but with paragraphs:

755 | 756 |
    757 |
  1. First

  2. 758 |
  3. Second:

    759 | 760 |
      761 |
    • Fee
    • 762 |
    • Fie
    • 763 |
    • Foe
    • 764 |
  4. 765 |
  5. Third

  6. 766 |
767 | 768 |

This was an error in Markdown 1.0.1:

769 | 770 | 779 | 780 |
781 |

foo

782 | 783 |
784 |

bar

785 |
786 | 787 |

foo

788 |
789 | 790 |

Markdown: Syntax

791 | 792 | 799 | 800 | 833 | 834 |

Note: This document is itself written using Markdown; you 835 | can [see the source for it by adding '.text' to the URL][src].

836 | 837 |

[src]: /projects/markdown/syntax.text

838 | 839 |
840 | 841 |

Overview

842 | 843 |

Philosophy

844 | 845 |

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

846 | 847 |

Readability, however, is emphasized above all else. A Markdown-formatted 848 | document should be publishable as-is, as plain text, without looking 849 | like it's been marked up with tags or formatting instructions. While 850 | Markdown's syntax has been influenced by several existing text-to-HTML 851 | filters -- including Setext, [atx] [2], [Textile] [3], [reStructuredText] [4], 852 | [Grutatext] [5], and [EtText] [6] -- the single biggest source of 853 | inspiration for Markdown's syntax is the format of plain text email.

854 | 855 |

1: http://docutils.sourceforge.net/mirror/setext.html 856 | [2]: http://www.aaronsw.com/2002/atx/ 857 | [3]: http://textism.com/tools/textile/ 858 | [4]: http://docutils.sourceforge.net/rst.html 859 | [5]: http://www.triptico.com/software/grutatxt.html 860 | [6]: http://ettext.taint.org/doc/

861 | 862 |

To this end, Markdown's syntax is comprised entirely of punctuation 863 | characters, which punctuation characters have been carefully chosen so 864 | as to look like what they mean. E.g., asterisks around a word actually 865 | look like *emphasis*. Markdown lists look like, well, lists. Even 866 | blockquotes look like quoted passages of text, assuming you've ever 867 | used email.

868 | 869 |

Inline HTML

870 | 871 |

Markdown's syntax is intended for one purpose: to be used as a 872 | format for writing for the web.

873 | 874 |

Markdown is not a replacement for HTML, or even close to it. Its 875 | syntax is very small, corresponding only to a very small subset of 876 | HTML tags. The idea is not to create a syntax that makes it easier 877 | to insert HTML tags. In my opinion, HTML tags are already easy to 878 | insert. The idea for Markdown is to make it easy to read, write, and 879 | edit prose. HTML is a publishing format; Markdown is a writing 880 | format. Thus, Markdown's formatting syntax only addresses issues that 881 | can be conveyed in plain text.

882 | 883 |

For any markup that is not covered by Markdown's syntax, you simply 884 | use HTML itself. There's no need to preface it or delimit it to 885 | indicate that you're switching from Markdown to HTML; you just use 886 | the tags.

887 | 888 |

The only restrictions are that block-level HTML elements -- e.g. <div>, 889 | <table>, <pre>, <p>, etc. -- must be separated from surrounding 890 | content by blank lines, and the start and end tags of the block should 891 | not be indented with tabs or spaces. Markdown is smart enough not 892 | to add extra (unwanted) <p> tags around HTML block-level tags.

893 | 894 |

For example, to add an HTML table to a Markdown article:

895 | 896 |
This is a regular paragraph.
 897 | 
 898 | <table>
 899 |     <tr>
 900 |         <td>Foo</td>
 901 |     </tr>
 902 | </table>
 903 | 
 904 | This is another regular paragraph.
 905 | 
906 | 907 |

Note that Markdown formatting syntax is not processed within block-level 908 | HTML tags. E.g., you can't use Markdown-style *emphasis* inside an 909 | HTML block.

910 | 911 |

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be 912 | used anywhere in a Markdown paragraph, list item, or header. If you 913 | want, you can even use HTML tags instead of Markdown formatting; e.g. if 914 | you'd prefer to use HTML <a> or <img> tags instead of Markdown's 915 | link or image syntax, go right ahead.

916 | 917 |

Unlike block-level HTML tags, Markdown syntax is processed within 918 | span-level tags.

919 | 920 |

Automatic Escaping for Special Characters

921 | 922 |

In HTML, there are two characters that demand special treatment: < 923 | and &. Left angle brackets are used to start tags; ampersands are 924 | used to denote HTML entities. If you want to use them as literal 925 | characters, you must escape them as entities, e.g. &lt;, and 926 | &amp;.

927 | 928 |

Ampersands in particular are bedeviling for web writers. If you want to 929 | write about 'AT&T', you need to write 'AT&amp;T'. You even need to 930 | escape ampersands within URLs. Thus, if you want to link to:

931 | 932 |
http://images.google.com/images?num=30&q=larry+bird
 933 | 
934 | 935 |

you need to encode the URL as:

936 | 937 |
http://images.google.com/images?num=30&amp;q=larry+bird
 938 | 
939 | 940 |

in your anchor tag href attribute. Needless to say, this is easy to 941 | forget, and is probably the single most common source of HTML validation 942 | errors in otherwise well-marked-up web sites.

943 | 944 |

Markdown allows you to use these characters naturally, taking care of 945 | all the necessary escaping for you. If you use an ampersand as part of 946 | an HTML entity, it remains unchanged; otherwise it will be translated 947 | into &amp;.

948 | 949 |

So, if you want to include a copyright symbol in your article, you can write:

950 | 951 |
&copy;
 952 | 
953 | 954 |

and Markdown will leave it alone. But if you write:

955 | 956 |
AT&T
 957 | 
958 | 959 |

Markdown will translate it to:

960 | 961 |
AT&amp;T
 962 | 
963 | 964 |

Similarly, because Markdown supports inline HTML, if you use 965 | angle brackets as delimiters for HTML tags, Markdown will treat them as 966 | such. But if you write:

967 | 968 |
4 < 5
 969 | 
970 | 971 |

Markdown will translate it to:

972 | 973 |
4 &lt; 5
 974 | 
975 | 976 |

However, inside Markdown code spans and blocks, angle brackets and 977 | ampersands are always encoded automatically. This makes it easy to use 978 | Markdown to write about HTML code. (As opposed to raw HTML, which is a 979 | terrible format for writing about HTML syntax, because every single < 980 | and & in your example code needs to be escaped.)

981 | 982 |
983 | 984 |

Block Elements

985 | 986 |

Paragraphs and Line Breaks

987 | 988 |

A paragraph is simply one or more consecutive lines of text, separated 989 | by one or more blank lines. (A blank line is any line that looks like a 990 | blank line -- a line containing nothing but spaces or tabs is considered 991 | blank.) Normal paragraphs should not be intended with spaces or tabs.

992 | 993 |

The implication of the "one or more consecutive lines of text" rule is 994 | that Markdown supports "hard-wrapped" text paragraphs. This differs 995 | significantly from most other text-to-HTML formatters (including Movable 996 | Type's "Convert Line Breaks" option) which translate every line break 997 | character in a paragraph into a <br /> tag.

998 | 999 |

When you do want to insert a <br /> break tag using Markdown, you 1000 | end a line with two or more spaces, then type return.

1001 | 1002 |

Yes, this takes a tad more effort to create a <br />, but a simplistic 1003 | "every line break is a <br />" rule wouldn't work for Markdown. 1004 | Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] 1005 | work best -- and look better -- when you format them with hard breaks.

1006 | 1007 |

[bq]: #blockquote 1008 | [l]: #list

1009 | 1010 |

Headers

1011 | 1012 |

Markdown supports two styles of headers, Setext and [atx] [2].

1013 | 1014 |

Setext-style headers are "underlined" using equal signs (for first-level 1015 | headers) and dashes (for second-level headers). For example:

1016 | 1017 |
This is an H1
1018 | =============
1019 | 
1020 | This is an H2
1021 | -------------
1022 | 
1023 | 1024 |

Any number of underlining ='s or -'s will work.

1025 | 1026 |

Atx-style headers use 1-6 hash characters at the start of the line, 1027 | corresponding to header levels 1-6. For example:

1028 | 1029 |
# This is an H1
1030 | 
1031 | ## This is an H2
1032 | 
1033 | ###### This is an H6
1034 | 
1035 | 1036 |

Optionally, you may "close" atx-style headers. This is purely 1037 | cosmetic -- you can use this if you think it looks better. The 1038 | closing hashes don't even need to match the number of hashes 1039 | used to open the header. (The number of opening hashes 1040 | determines the header level.) :

1041 | 1042 |
# This is an H1 #
1043 | 
1044 | ## This is an H2 ##
1045 | 
1046 | ### This is an H3 ######
1047 | 
1048 | 1049 |

Blockquotes

1050 | 1051 |

Markdown uses email-style > characters for blockquoting. If you're 1052 | familiar with quoting passages of text in an email message, then you 1053 | know how to create a blockquote in Markdown. It looks best if you hard 1054 | wrap the text and put a > before every line:

1055 | 1056 |
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
1057 | > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
1058 | > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
1059 | >
1060 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
1061 | > id sem consectetuer libero luctus adipiscing.
1062 | 
1063 | 1064 |

Markdown allows you to be lazy and only put the > before the first 1065 | line of a hard-wrapped paragraph:

1066 | 1067 |
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
1068 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
1069 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
1070 | 
1071 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
1072 | id sem consectetuer libero luctus adipiscing.
1073 | 
1074 | 1075 |

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by 1076 | adding additional levels of >:

1077 | 1078 |
> This is the first level of quoting.
1079 | >
1080 | > > This is nested blockquote.
1081 | >
1082 | > Back to the first level.
1083 | 
1084 | 1085 |

Blockquotes can contain other Markdown elements, including headers, lists, 1086 | and code blocks:

1087 | 1088 |
> ## This is a header.
1089 | >
1090 | > 1.   This is the first list item.
1091 | > 2.   This is the second list item.
1092 | >
1093 | > Here's some example code:
1094 | >
1095 | >     return shell_exec("echo $input | $markdown_script");
1096 | 
1097 | 1098 |

Any decent text editor should make email-style quoting easy. For 1099 | example, with BBEdit, you can make a selection and choose Increase 1100 | Quote Level from the Text menu.

1101 | 1102 |

Lists

1103 | 1104 |

Markdown supports ordered (numbered) and unordered (bulleted) lists.

1105 | 1106 |

Unordered lists use asterisks, pluses, and hyphens -- interchangably 1107 | -- as list markers:

1108 | 1109 |
*   Red
1110 | *   Green
1111 | *   Blue
1112 | 
1113 | 1114 |

is equivalent to:

1115 | 1116 |
+   Red
1117 | +   Green
1118 | +   Blue
1119 | 
1120 | 1121 |

and:

1122 | 1123 |
-   Red
1124 | -   Green
1125 | -   Blue
1126 | 
1127 | 1128 |

Ordered lists use numbers followed by periods:

1129 | 1130 |
1.  Bird
1131 | 2.  McHale
1132 | 3.  Parish
1133 | 
1134 | 1135 |

It's important to note that the actual numbers you use to mark the 1136 | list have no effect on the HTML output Markdown produces. The HTML 1137 | Markdown produces from the above list is:

1138 | 1139 |
<ol>
1140 | <li>Bird</li>
1141 | <li>McHale</li>
1142 | <li>Parish</li>
1143 | </ol>
1144 | 
1145 | 1146 |

If you instead wrote the list in Markdown like this:

1147 | 1148 |
1.  Bird
1149 | 1.  McHale
1150 | 1.  Parish
1151 | 
1152 | 1153 |

or even:

1154 | 1155 |
3. Bird
1156 | 1. McHale
1157 | 8. Parish
1158 | 
1159 | 1160 |

you'd get the exact same HTML output. The point is, if you want to, 1161 | you can use ordinal numbers in your ordered Markdown lists, so that 1162 | the numbers in your source match the numbers in your published HTML. 1163 | But if you want to be lazy, you don't have to.

1164 | 1165 |

If you do use lazy list numbering, however, you should still start the 1166 | list with the number 1. At some point in the future, Markdown may support 1167 | starting ordered lists at an arbitrary number.

1168 | 1169 |

List markers typically start at the left margin, but may be indented by 1170 | up to three spaces. List markers must be followed by one or more spaces 1171 | or a tab.

1172 | 1173 |

To make lists look nice, you can wrap items with hanging indents:

1174 | 1175 |
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
1176 |     Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
1177 |     viverra nec, fringilla in, laoreet vitae, risus.
1178 | *   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
1179 |     Suspendisse id sem consectetuer libero luctus adipiscing.
1180 | 
1181 | 1182 |

But if you want to be lazy, you don't have to:

1183 | 1184 |
*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
1185 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
1186 | viverra nec, fringilla in, laoreet vitae, risus.
1187 | *   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
1188 | Suspendisse id sem consectetuer libero luctus adipiscing.
1189 | 
1190 | 1191 |

If list items are separated by blank lines, Markdown will wrap the 1192 | items in <p> tags in the HTML output. For example, this input:

1193 | 1194 |
*   Bird
1195 | *   Magic
1196 | 
1197 | 1198 |

will turn into:

1199 | 1200 |
<ul>
1201 | <li>Bird</li>
1202 | <li>Magic</li>
1203 | </ul>
1204 | 
1205 | 1206 |

But this:

1207 | 1208 |
*   Bird
1209 | 
1210 | *   Magic
1211 | 
1212 | 1213 |

will turn into:

1214 | 1215 |
<ul>
1216 | <li><p>Bird</p></li>
1217 | <li><p>Magic</p></li>
1218 | </ul>
1219 | 
1220 | 1221 |

List items may consist of multiple paragraphs. Each subsequent 1222 | paragraph in a list item must be intended by either 4 spaces 1223 | or one tab:

1224 | 1225 |
1.  This is a list item with two paragraphs. Lorem ipsum dolor
1226 |     sit amet, consectetuer adipiscing elit. Aliquam hendrerit
1227 |     mi posuere lectus.
1228 | 
1229 |     Vestibulum enim wisi, viverra nec, fringilla in, laoreet
1230 |     vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
1231 |     sit amet velit.
1232 | 
1233 | 2.  Suspendisse id sem consectetuer libero luctus adipiscing.
1234 | 
1235 | 1236 |

It looks nice if you indent every line of the subsequent 1237 | paragraphs, but here again, Markdown will allow you to be 1238 | lazy:

1239 | 1240 |
*   This is a list item with two paragraphs.
1241 | 
1242 |     This is the second paragraph in the list item. You're
1243 | only required to indent the first line. Lorem ipsum dolor
1244 | sit amet, consectetuer adipiscing elit.
1245 | 
1246 | *   Another item in the same list.
1247 | 
1248 | 1249 |

To put a blockquote within a list item, the blockquote's > 1250 | delimiters need to be indented:

1251 | 1252 |
*   A list item with a blockquote:
1253 | 
1254 |     > This is a blockquote
1255 |     > inside a list item.
1256 | 
1257 | 1258 |

To put a code block within a list item, the code block needs 1259 | to be indented twice -- 8 spaces or two tabs:

1260 | 1261 |
*   A list item with a code block:
1262 | 
1263 |         <code goes here>
1264 | 
1265 | 1266 |

It's worth noting that it's possible to trigger an ordered list by 1267 | accident, by writing something like this:

1268 | 1269 |
1986. What a great season.
1270 | 
1271 | 1272 |

In other words, a number-period-space sequence at the beginning of a 1273 | line. To avoid this, you can backslash-escape the period:

1274 | 1275 |
1986\. What a great season.
1276 | 
1277 | 1278 |

Code Blocks

1279 | 1280 |

Pre-formatted code blocks are used for writing about programming or 1281 | markup source code. Rather than forming normal paragraphs, the lines 1282 | of a code block are interpreted literally. Markdown wraps a code block 1283 | in both <pre> and <code> tags.

1284 | 1285 |

To produce a code block in Markdown, simply indent every line of the 1286 | block by at least 4 spaces or 1 tab. For example, given this input:

1287 | 1288 |
This is a normal paragraph:
1289 | 
1290 |     This is a code block.
1291 | 
1292 | 1293 |

Markdown will generate:

1294 | 1295 |
<p>This is a normal paragraph:</p>
1296 | 
1297 | <pre><code>This is a code block.
1298 | </code></pre>
1299 | 
1300 | 1301 |

One level of indentation -- 4 spaces or 1 tab -- is removed from each 1302 | line of the code block. For example, this:

1303 | 1304 |
Here is an example of AppleScript:
1305 | 
1306 |     tell application "Foo"
1307 |         beep
1308 |     end tell
1309 | 
1310 | 1311 |

will turn into:

1312 | 1313 |
<p>Here is an example of AppleScript:</p>
1314 | 
1315 | <pre><code>tell application "Foo"
1316 |     beep
1317 | end tell
1318 | </code></pre>
1319 | 
1320 | 1321 |

A code block continues until it reaches a line that is not indented 1322 | (or the end of the article).

1323 | 1324 |

Within a code block, ampersands (&) and angle brackets (< and >) 1325 | are automatically converted into HTML entities. This makes it very 1326 | easy to include example HTML source code using Markdown -- just paste 1327 | it and indent it, and Markdown will handle the hassle of encoding the 1328 | ampersands and angle brackets. For example, this:

1329 | 1330 |
    <div class="footer">
1331 |         &copy; 2004 Foo Corporation
1332 |     </div>
1333 | 
1334 | 1335 |

will turn into:

1336 | 1337 |
<pre><code>&lt;div class="footer"&gt;
1338 |     &amp;copy; 2004 Foo Corporation
1339 | &lt;/div&gt;
1340 | </code></pre>
1341 | 
1342 | 1343 |

Regular Markdown syntax is not processed within code blocks. E.g., 1344 | asterisks are just literal asterisks within a code block. This means 1345 | it's also easy to use Markdown to write about Markdown's own syntax.

1346 | 1347 |

Horizontal Rules

1348 | 1349 |

You can produce a horizontal rule tag (<hr />) by placing three or 1350 | more hyphens, asterisks, or underscores on a line by themselves. If you 1351 | wish, you may use spaces between the hyphens or asterisks. Each of the 1352 | following lines will produce a horizontal rule:

1353 | 1354 |
* * *
1355 | 
1356 | ***
1357 | 
1358 | *****
1359 | 
1360 | - - -
1361 | 
1362 | ---------------------------------------
1363 | 
1364 | _ _ _
1365 | 
1366 | 1367 |
1368 | 1369 |

Span Elements

1370 | 1371 | 1372 | 1373 |

Markdown supports two style of links: inline and reference.

1374 | 1375 |

In both styles, the link text is delimited by [square brackets].

1376 | 1377 |

To create an inline link, use a set of regular parentheses immediately 1378 | after the link text's closing square bracket. Inside the parentheses, 1379 | put the URL where you want the link to point, along with an optional 1380 | title for the link, surrounded in quotes. For example:

1381 | 1382 |
This is [an example](http://example.com/ "Title") inline link.
1383 | 
1384 | [This link](http://example.net/) has no title attribute.
1385 | 
1386 | 1387 |

Will produce:

1388 | 1389 |
<p>This is <a href="http://example.com/" title="Title">
1390 | an example</a> inline link.</p>
1391 | 
1392 | <p><a href="http://example.net/">This link</a> has no
1393 | title attribute.</p>
1394 | 
1395 | 1396 |

If you're referring to a local resource on the same server, you can 1397 | use relative paths:

1398 | 1399 |
See my [About](/about/) page for details.
1400 | 
1401 | 1402 |

Reference-style links use a second set of square brackets, inside 1403 | which you place a label of your choosing to identify the link:

1404 | 1405 |
This is [an example][id] reference-style link.
1406 | 
1407 | 1408 |

You can optionally use a space to separate the sets of brackets:

1409 | 1410 |
This is [an example] [id] reference-style link.
1411 | 
1412 | 1413 |

Then, anywhere in the document, you define your link label like this, 1414 | on a line by itself:

1415 | 1416 |
[id]: http://example.com/  "Optional Title Here"
1417 | 
1418 | 1419 |

That is:

1420 | 1421 | 1430 | 1431 |

The link URL may, optionally, be surrounded by angle brackets:

1432 | 1433 |
[id]: <http://example.com/>  "Optional Title Here"
1434 | 
1435 | 1436 |

You can put the title attribute on the next line and use extra spaces 1437 | or tabs for padding, which tends to look better with longer URLs:

1438 | 1439 |
[id]: http://example.com/longish/path/to/resource/here
1440 |     "Optional Title Here"
1441 | 
1442 | 1443 |

Link definitions are only used for creating links during Markdown 1444 | processing, and are stripped from your document in the HTML output.

1445 | 1446 |

Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

1447 | 1448 |
[link text][a]
1449 | [link text][A]
1450 | 
1451 | 1452 |

are equivalent.

1453 | 1454 |

The implicit link name shortcut allows you to omit the name of the 1455 | link, in which case the link text itself is used as the name. 1456 | Just use an empty set of square brackets -- e.g., to link the word 1457 | "Google" to the google.com web site, you could simply write:

1458 | 1459 |
[Google][]
1460 | 
1461 | 1462 |

And then define the link:

1463 | 1464 |
[Google]: http://google.com/
1465 | 
1466 | 1467 |

Because link names may contain spaces, this shortcut even works for 1468 | multiple words in the link text:

1469 | 1470 |
Visit [Daring Fireball][] for more information.
1471 | 
1472 | 1473 |

And then define the link:

1474 | 1475 |
[Daring Fireball]: http://daringfireball.net/
1476 | 
1477 | 1478 |

Link definitions can be placed anywhere in your Markdown document. I 1479 | tend to put them immediately after each paragraph in which they're 1480 | used, but if you want, you can put them all at the end of your 1481 | document, sort of like footnotes.

1482 | 1483 |

Here's an example of reference links in action:

1484 | 1485 |
I get 10 times more traffic from [Google] [1] than from
1486 | [Yahoo] [2] or [MSN] [3].
1487 | 
1488 |   [1]: http://google.com/        "Google"
1489 |   [2]: http://search.yahoo.com/  "Yahoo Search"
1490 |   [3]: http://search.msn.com/    "MSN Search"
1491 | 
1492 | 1493 |

Using the implicit link name shortcut, you could instead write:

1494 | 1495 |
I get 10 times more traffic from [Google][] than from
1496 | [Yahoo][] or [MSN][].
1497 | 
1498 |   [google]: http://google.com/        "Google"
1499 |   [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
1500 |   [msn]:    http://search.msn.com/    "MSN Search"
1501 | 
1502 | 1503 |

Both of the above examples will produce the following HTML output:

1504 | 1505 |
<p>I get 10 times more traffic from <a href="http://google.com/"
1506 | title="Google">Google</a> than from
1507 | <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
1508 | or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
1509 | 
1510 | 1511 |

For comparison, here is the same paragraph written using 1512 | Markdown's inline link style:

1513 | 1514 |
I get 10 times more traffic from [Google](http://google.com/ "Google")
1515 | than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
1516 | [MSN](http://search.msn.com/ "MSN Search").
1517 | 
1518 | 1519 |

The point of reference-style links is not that they're easier to 1520 | write. The point is that with reference-style links, your document 1521 | source is vastly more readable. Compare the above examples: using 1522 | reference-style links, the paragraph itself is only 81 characters 1523 | long; with inline-style links, it's 176 characters; and as raw HTML, 1524 | it's 234 characters. In the raw HTML, there's more markup than there 1525 | is text.

1526 | 1527 |

With Markdown's reference-style links, a source document much more 1528 | closely resembles the final output, as rendered in a browser. By 1529 | allowing you to move the markup-related metadata out of the paragraph, 1530 | you can add links without interrupting the narrative flow of your 1531 | prose.

1532 | 1533 |

Emphasis

1534 | 1535 |

Markdown treats asterisks (*) and underscores (_) as indicators of 1536 | emphasis. Text wrapped with one * or _ will be wrapped with an 1537 | HTML <em> tag; double *'s or _'s will be wrapped with an HTML 1538 | <strong> tag. E.g., this input:

1539 | 1540 |
*single asterisks*
1541 | 
1542 | _single underscores_
1543 | 
1544 | **double asterisks**
1545 | 
1546 | __double underscores__
1547 | 
1548 | 1549 |

will produce:

1550 | 1551 |
<em>single asterisks</em>
1552 | 
1553 | <em>single underscores</em>
1554 | 
1555 | <strong>double asterisks</strong>
1556 | 
1557 | <strong>double underscores</strong>
1558 | 
1559 | 1560 |

You can use whichever style you prefer; the lone restriction is that 1561 | the same character must be used to open and close an emphasis span.

1562 | 1563 |

Emphasis can be used in the middle of a word:

1564 | 1565 |
un*fucking*believable
1566 | 
1567 | 1568 |

But if you surround an * or _ with spaces, it'll be treated as a 1569 | literal asterisk or underscore.

1570 | 1571 |

To produce a literal asterisk or underscore at a position where it 1572 | would otherwise be used as an emphasis delimiter, you can backslash 1573 | escape it:

1574 | 1575 |
\*this text is surrounded by literal asterisks\*
1576 | 
1577 | 1578 |

Code

1579 | 1580 |

To indicate a span of code, wrap it with backtick quotes (`). 1581 | Unlike a pre-formatted code block, a code span indicates code within a 1582 | normal paragraph. For example:

1583 | 1584 |
Use the `printf()` function.
1585 | 
1586 | 1587 |

will produce:

1588 | 1589 |
<p>Use the <code>printf()</code> function.</p>
1590 | 
1591 | 1592 |

To include a literal backtick character within a code span, you can use 1593 | multiple backticks as the opening and closing delimiters:

1594 | 1595 |
``There is a literal backtick (`) here.``
1596 | 
1597 | 1598 |

which will produce this:

1599 | 1600 |
<p><code>There is a literal backtick (`) here.</code></p>
1601 | 
1602 | 1603 |

The backtick delimiters surrounding a code span may include spaces -- 1604 | one after the opening, one before the closing. This allows you to place 1605 | literal backtick characters at the beginning or end of a code span:

1606 | 1607 |
A single backtick in a code span: `` ` ``
1608 | 
1609 | A backtick-delimited string in a code span: `` `foo` ``
1610 | 
1611 | 1612 |

will produce:

1613 | 1614 |
<p>A single backtick in a code span: <code>`</code></p>
1615 | 
1616 | <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
1617 | 
1618 | 1619 |

With a code span, ampersands and angle brackets are encoded as HTML 1620 | entities automatically, which makes it easy to include example HTML 1621 | tags. Markdown will turn this:

1622 | 1623 |
Please don't use any `<blink>` tags.
1624 | 
1625 | 1626 |

into:

1627 | 1628 |
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
1629 | 
1630 | 1631 |

You can write this:

1632 | 1633 |
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
1634 | 
1635 | 1636 |

to produce:

1637 | 1638 |
<p><code>&amp;#8212;</code> is the decimal-encoded
1639 | equivalent of <code>&amp;mdash;</code>.</p>
1640 | 
1641 | 1642 |

Images

1643 | 1644 |

Admittedly, it's fairly difficult to devise a "natural" syntax for 1645 | placing images into a plain text document format.

1646 | 1647 |

Markdown uses an image syntax that is intended to resemble the syntax 1648 | for links, allowing for two styles: inline and reference.

1649 | 1650 |

Inline image syntax looks like this:

1651 | 1652 |
![Alt text](/path/to/img.jpg)
1653 | 
1654 | ![Alt text](/path/to/img.jpg "Optional title")
1655 | 
1656 | 1657 |

That is:

1658 | 1659 | 1667 | 1668 |

Reference-style image syntax looks like this:

1669 | 1670 |
![Alt text][id]
1671 | 
1672 | 1673 |

Where "id" is the name of a defined image reference. Image references 1674 | are defined using syntax identical to link references:

1675 | 1676 |
[id]: url/to/image  "Optional title attribute"
1677 | 
1678 | 1679 |

As of this writing, Markdown has no syntax for specifying the 1680 | dimensions of an image; if this is important to you, you can simply 1681 | use regular HTML <img> tags.

1682 | 1683 |
1684 | 1685 |

Miscellaneous

1686 | 1687 | 1688 | 1689 |

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

1690 | 1691 |
<http://example.com/>
1692 | 
1693 | 1694 |

Markdown will turn this into:

1695 | 1696 |
<a href="http://example.com/">http://example.com/</a>
1697 | 
1698 | 1699 |

Automatic links for email addresses work similarly, except that 1700 | Markdown will also perform a bit of randomized decimal and hex 1701 | entity-encoding to help obscure your address from address-harvesting 1702 | spambots. For example, Markdown will turn this:

1703 | 1704 |
<address@example.com>
1705 | 
1706 | 1707 |

into something like this:

1708 | 1709 |
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
1710 | &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
1711 | &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
1712 | &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
1713 | 
1714 | 1715 |

which will render in a browser as a clickable link to "address@example.com".

1716 | 1717 |

(This sort of entity-encoding trick will indeed fool many, if not 1718 | most, address-harvesting bots, but it definitely won't fool all of 1719 | them. It's better than nothing, but an address published in this way 1720 | will probably eventually start receiving spam.)

1721 | 1722 |

Backslash Escapes

1723 | 1724 |

Markdown allows you to use backslash escapes to generate literal 1725 | characters which would otherwise have special meaning in Markdown's 1726 | formatting syntax. For example, if you wanted to surround a word with 1727 | literal asterisks (instead of an HTML <em> tag), you can backslashes 1728 | before the asterisks, like this:

1729 | 1730 |
\*literal asterisks\*
1731 | 
1732 | 1733 |

Markdown provides backslash escapes for the following characters:

1734 | 1735 |
\   backslash
1736 | `   backtick
1737 | *   asterisk
1738 | _   underscore
1739 | {}  curly braces
1740 | []  square brackets
1741 | ()  parentheses
1742 | #   hash mark
1743 | +   plus sign
1744 | -   minus sign (hyphen)
1745 | .   dot
1746 | !   exclamation mark
1747 | 
1748 | 1749 |

Foo [bar][].

1750 | 1751 |

Foo bar.

1752 | 1753 |

[bar]: /url/ "Title with "quotes" inside"

1754 | 1755 |

This is the [simple case].

1756 | 1757 |

[simple case]: /simple

1758 | 1759 |

This one has a [line 1760 | break].

1761 | 1762 |

This one has a [line 1763 | break] with a line-ending space.

1764 | 1765 |

[line break]: /foo

1766 | 1767 |

[this] [that] and the [other]

1768 | 1769 |

[this]: /this 1770 | [that]: /that 1771 | [other]: /other

1772 | 1773 |

Here's a simple block:

1774 | 1775 |
1776 | foo 1777 |
1778 | 1779 |

This should be a code block, though:

1780 | 1781 |
<div>
1782 |     foo
1783 | </div>
1784 | 
1785 | 1786 |

As should this:

1787 | 1788 |
<div>foo</div>
1789 | 
1790 | 1791 |

Now, nested:

1792 | 1793 |
1794 |
1795 |
1796 | foo 1797 |
1798 |
1799 |
1800 | 1801 |

This should just be an HTML comment:

1802 | 1803 | 1804 | 1805 |

Multiline:

1806 | 1807 | 1808 | 1809 |

Code block:

1810 | 1811 |
<!-- Comment -->
1812 | 
1813 | 1814 |

Just plain comment, with trailing spaces on the line:

1815 | 1816 | 1817 | 1818 |

Code:

1819 | 1820 |
<hr />
1821 | 
1822 | 1823 |

Hr's:

1824 | 1825 |
1826 | 1827 |
1828 | 1829 |
1830 | 1831 |
1832 | 1833 |
1834 | 1835 |
1836 | 1837 |
1838 | 1839 |
1840 | 1841 |
1842 | 1843 |
var gulp = require('gulp');
1844 | var myth = require('gulp-myth');
1845 | 
1846 | gulp.task('default', function () {
1847 |     return gulp.src('src/app.css')
1848 |         .pipe(myth())
1849 |         .pipe(gulp.dest('dist'));
1850 | });
1851 |
1852 | Fork me on GitHub 1853 | 1854 | 1855 | --------------------------------------------------------------------------------