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