1Markdown 2======== 3 4This site can handle normal Markdown and many common extensions. To learn 5how the following is done please see the [source for this page](./markdown.md). 6Any file you put under `/site/` that has the extension `.md` will be processed 7as Markdown. All other files will be served directly. For example, images 8can be added and they will be served correctly and referenced from within Markdown files. 9 10When preparing for a code review of site docs you can get a preview of how the 11page will render by visiting the skia.org site and add a query parameter `cl` 12with the value of the Reitveld issue id: 13 14 https://skia.org/path/to/markdown-file?cl=REITVELD_ISSUE_NUMBER 15 16This is the preferred method of previewing docs changes. 17 18If for some reason you can't use the method above to preview docs changes you 19can also run a local copy of the documentation server, which will allow you to 20preview changes much quicker. You must have a recent version (>=8.9) of 21[node](https://nodejs.org/) installed on your machine. You must also have 22[Go](https://golang.org) installed on your computer, which you will have if 23you are running on a Google corporate workstation. Installation also means 24that you have `$GOPATH/bin` [added to your PATH](https://golang.org/doc/code.html#GOPATH). Run: 25 26 go get -u go.skia.org/infra/doc/go/docserver 27 cd $GOPATH/src/go.skia.org/infra/doc 28 make 29 30And then **from within** the directory of your local Git checkout of Skia run: 31 32 docserver --preview --local 33 34Then visit http://localhost:8000 to preview your changes. There is no need to 35restart the server for file changes, but you will need to restart it if there 36are changes to the navigation menu, i.e. you add or remove a file and want it 37to appear in the navigation on the right hand side of the page. 38 39If port 8000 is unavailable on your machine you can set the port to use via 40the --port flag: 41 42 docserver --preview --local --port=:8002 43 44METADATA 45-------- 46 47By default all files and directories that appear in the same level are sorted 48alphabetically by file name in the navigation menu, with files appearing 49before directories. You can override this default behavior by adding a 50METADATA file to a directory. A METADATA file is a JSON file of the following 51format: 52 53~~~~ 54 { 55 "dirOrder": ["sample", "quick", "special"], 56 "fileOrder": ["download", "api"] 57 } 58~~~~ 59 60If a file or directory doesn't appear in `dirOrder` or `fileOrder` then it is sorted 61to appear after the members of `dirOrder` or `fileOrder` respectively. All 62files and directories that aren't controlled by a METADATA file are sorted in 63alphabetical order by their filename. 64 65Some Example Markdown 66--------------------- 67 68This is a [link](https://www.google.com). You can also create 69ordered and unordered lists: 70 711. First 722. Second: 73 * Fee 74 * Fie 75 * Foe 76 * Fum 773. Third 78 79Incorporate images: 80 81![image](/dev/tools/image.png) 82 83Or go old school and use [ASCII art](http://asciiflow.com/): 84 85~~~~ 86 87 +----------------+ 88 | Should you | 89 +--+ use ASCII art? +--+ 90 | +----------------+ | 91 | | 92+---v---+ +---v---+ 93| | | | 94| Yes | | No | 95| | | | 96+-------+ +-------+ 97 98~~~~ 99 100Format code snippets or other preformatted text. Just surround the code 101with `~~~~`. You can also trigger syntax highlighting by putting in 102the following HTML comment before the code section: 103 104 <!--?prettify?--> 105 106 107<!--?prettify?--> 108~~~~ 109class SK_API SkPaint { 110public: 111 SkPaint(); 112 SkPaint(const SkPaint& paint); 113 ~SkPaint(); 114 115 SkPaint& operator=(const SkPaint&); 116~~~~ 117 118 119Tables 120 121 Name | Value | Summary 122 --------|----------|-------- 123 A | 27 | yes 124 B | 23 | no 125 126 127There are also inline styles for *emphasis*, **bold**, 128~~strikethrough~~, and `inline code`. Also small fractions, 129such as 1/2 are rendered nicely. 130 131> # There are 132> ## Headers 133> ### Up To 134> #### Six 135> ##### Levels 136> ###### Deep 137 138And you can <b>always</b> use HTML, which is useful for features that can't be 139done in Markdown, such as iframes, but try to avoid using HTML outside of 140sitations like that. 141<svg viewBox="0 0 24 24" height="24px" width="24px" style="display: inline;"> 142 <g> 143 <path d="M1 144 21h4v-12h-4v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06l-1.06-1.05-6.58 145 6.59c-.37.36-.59.86-.59 1.41v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 146 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1.91l-.01-.01.01-.08z"> </path> 147 </g> 148</svg> 149 150Reference 151========= 152 153Below is a longer reference on the Markdown that docserver accepts. 154 155Paragraphs 156---------- 157 158A paragraph is simply one or more consecutive lines of text, separated 159by one or more blank lines. (A blank line is any line that looks like a 160blank line -- a line containing nothing. Note: all spaces or tabs is considered 161blank.) Normal paragraphs should not be intended with spaces or tabs. 162 163Headers and Blockquotes 164----------------------- 165 166You can create headers by either "underlining" with equal signs (`=`) and hyphens (`-`), 167or,you can put 1-6 hash marks (`#`) at the 168beginning of the line -- the number of hashes equals the resulting 169HTML header level. 170 171Blockquotes are indicated using email-style '`>`' angle brackets. 172 173Markdown: 174 175 A First Level Header 176 ==================== 177 178 A Second Level Header 179 --------------------- 180 181 Now is the time for all good men to come to 182 the aid of their country. This is just a 183 regular paragraph. 184 185 The quick brown fox jumped over the lazy 186 dog's back. 187 188 ### Header 3 189 190 > This is a blockquote. 191 > 192 > This is the second paragraph in the blockquote. 193 > 194 > ## This is an H2 in a blockquote 195 196 197Output: 198 199 <h1>A First Level Header</h1> 200 201 <h2>A Second Level Header</h2> 202 203 <p>Now is the time for all good men to come to 204 the aid of their country. This is just a 205 regular paragraph.</p> 206 207 <p>The quick brown fox jumped over the lazy 208 dog's back.</p> 209 210 <h3>Header 3</h3> 211 212 <blockquote> 213 <p>This is a blockquote.</p> 214 215 <p>This is the second paragraph in the blockquote.</p> 216 217 <h2>This is an H2 in a blockquote</h2> 218 </blockquote> 219 220 221 222### Phrase Emphasis ### 223 224Markdown uses asterisks and underscores to indicate spans of emphasis. 225 226Markdown: 227 228 Some of these words *are emphasized*. 229 Some of these words _are emphasized also_. 230 231 Use two asterisks for **strong emphasis**. 232 Or, if you prefer, __use two underscores instead__. 233 234Output: 235 236 <p>Some of these words <em>are emphasized</em>. 237 Some of these words <em>are emphasized also</em>.</p> 238 239 <p>Use two asterisks for <strong>strong emphasis</strong>. 240 Or, if you prefer, <strong>use two underscores instead</strong>.</p> 241 242 243 244## Lists ## 245 246Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, 247`+`, and `-`) as list markers. These three markers are 248interchangable; this: 249 250 * Candy. 251 * Gum. 252 * Booze. 253 254this: 255 256 + Candy. 257 + Gum. 258 + Booze. 259 260and this: 261 262 - Candy. 263 - Gum. 264 - Booze. 265 266all produce the same output: 267 268 <ul> 269 <li>Candy.</li> 270 <li>Gum.</li> 271 <li>Booze.</li> 272 </ul> 273 274Ordered (numbered) lists use regular numbers, followed by periods, as 275list markers: 276 277 1. Red 278 2. Green 279 3. Blue 280 281Output: 282 283 <ol> 284 <li>Red</li> 285 <li>Green</li> 286 <li>Blue</li> 287 </ol> 288 289If you put blank lines between items, you'll get `<p>` tags for the 290list item text. You can create multi-paragraph list items by indenting 291the paragraphs by 4 spaces or 1 tab: 292 293 * A list item. 294 295 With multiple paragraphs. 296 297 * Another item in the list. 298 299Output: 300 301 <ul> 302 <li><p>A list item.</p> 303 <p>With multiple paragraphs.</p></li> 304 <li><p>Another item in the list.</p></li> 305 </ul> 306 307 308 309### Links ### 310 311Markdown supports two styles for creating links: *inline* and 312*reference*. With both styles, you use square brackets to delimit the 313text you want to turn into a link. 314 315Inline-style links use parentheses immediately after the link text. 316For example: 317 318 This is an [example link](http://example.com/). 319 320Output: 321 322 <p>This is an <a href="http://example.com/"> 323 example link</a>.</p> 324 325Optionally, you may include a title attribute in the parentheses: 326 327 This is an [example link](http://example.com/ "With a Title"). 328 329Output: 330 331 <p>This is an <a href="http://example.com/" title="With a Title"> 332 example link</a>.</p> 333 334Reference-style links allow you to refer to your links by names, which 335you define elsewhere in your document: 336 337 I get 10 times more traffic from [Google][1] than from 338 [Yahoo][2] or [MSN][3]. 339 340 [1]: http://google.com/ "Google" 341 [2]: http://search.yahoo.com/ "Yahoo Search" 342 [3]: http://search.msn.com/ "MSN Search" 343 344Output: 345 346 <p>I get 10 times more traffic from <a href="http://google.com/" 347 title="Google">Google</a> than from <a href="http://search.yahoo.com/" 348 title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/" 349 title="MSN Search">MSN</a>.</p> 350 351The title attribute is optional. Link names may contain letters, 352numbers and spaces, but are *not* case sensitive: 353 354 I start my morning with a cup of coffee and 355 [The New York Times][NY Times]. 356 357 [ny times]: http://www.nytimes.com/ 358 359Output: 360 361 <p>I start my morning with a cup of coffee and 362 <a href="http://www.nytimes.com/">The New York Times</a>.</p> 363 364 365### Images ### 366 367Image syntax is very much like link syntax. 368 369Inline (titles are optional): 370 371 ![alt text](/path/to/img.jpg "Title") 372 373Reference-style: 374 375 ![alt text][id] 376 377 [id]: /path/to/img.jpg "Title" 378 379Both of the above examples produce the same output: 380 381 <img src="/path/to/img.jpg" alt="alt text" title="Title" /> 382 383 384 385### Code ### 386 387In a regular paragraph, you can create code span by wrapping text in 388backtick quotes. Any ampersands (`&`) and angle brackets (`<` or 389`>`) will automatically be translated into HTML entities. This makes 390it easy to use Markdown to write about HTML example code: 391 392 I strongly recommend against using any `<blink>` tags. 393 394 I wish SmartyPants used named entities like `—` 395 instead of decimal-encoded entites like `—`. 396 397Output: 398 399 <p>I strongly recommend against using any 400 <code><blink></code> tags.</p> 401 402 <p>I wish SmartyPants used named entities like 403 <code>&mdash;</code> instead of decimal-encoded 404 entites like <code>&#8212;</code>.</p> 405 406 407To specify an entire block of pre-formatted code, indent every line of 408the block by 4 spaces or 1 tab, or add a line containing three backticks before 409and after the code block. Just like with code spans, `&`, `<`, 410and `>` characters will be escaped automatically. 411 412Markdown: 413 414 If you want your page to validate under XHTML 1.0 Strict, 415 you've got to put paragraph tags in your blockquotes: 416 417 <blockquote> 418 <p>For example.</p> 419 </blockquote> 420 421or 422 423 If you want your page to validate under XHTML 1.0 Strict, 424 you've got to put paragraph tags in your blockquotes: 425 426 ``` 427 <blockquote> 428 <p>For example.</p> 429 </blockquote> 430 ``` 431 432Output: 433 434 <p>If you want your page to validate under XHTML 1.0 Strict, 435 you've got to put paragraph tags in your blockquotes:</p> 436 437 <pre><code><blockquote> 438 <p>For example.</p> 439 </blockquote> 440 </code></pre> 441 442 443### Floating Menu ### 444 445To create a floating menu for a single page that always appears 446in the upper right hand corner of the page, use a `div` with a 447class of "float", for example: 448 449 <div class="float"> 450 <ul> 451 <li><a href="#SkXfermode">SkXfermode</a></li> 452 <li><a href="#SkShader">SkShader</a></li> 453 <li><a href="#SkMaskFilter">SkMaskFilter</a></li> 454 <li><a href="#SkColorFilter">SkColorFilter</a></li> 455 <li><a href="#SkPathEffect">SkPathEffect</a></li> 456 </ul> 457 </div> 458 459