• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16You can also run a local copy of the documentation server, which will allow
17you to preview changes much quicker. You must have [Go](https://golang.org)
18installed on your computer, which you will have if you are running on a Google
19corporate workstation. Run:
20
21    go get skia.googlesource.com/buildbot.git/doc/go/docserver
22
23And then **from within** the directory of your local Git checkout of Skia run:
24
25    docserver --preview
26
27Then visit http://localhost:8000 to preview your changes. There is no need to
28restart the server for file changes, but you will need to restart it if there
29are changes to the navigation menu, i.e. you add or remove a file and want it
30to appear in the navigation on the right hand side of the page.
31
32If port 8000 is unavailable on your machine you can set the port to use via
33the --port flag:
34
35    docserver --preview --port=:8002
36
37METADATA
38--------
39
40By default all files and directories that appear in the same level are sorted
41alphabetically by file name in the navigation menu, with files appearing
42before directories. You can override this default behavior by adding a
43METADATA file to a directory. A METADATA file is a JSON file of the following
44format:
45
46~~~~
47   {
48     "dirOrder": ["sample", "quick", "special"],
49     "fileOrder": ["download", "api"]
50   }
51~~~~
52
53If a file or directory doesn't appear in `dirOrder` or `fileOrder` then it is sorted
54to appear after the members of `dirOrder` or `fileOrder` respectively. All
55files and directories that aren't controlled by a METADATA file are sorted in
56alphabetical order by their filename.
57
58Some Example MarkDown
59---------------------
60
61This is a [link](https://www.google.com). You can also create
62ordered and unordered lists:
63
641. First
652. Second:
66  * Fee
67    * Fie
68      * Foe
69  * Fum
703. Third
71
72Incorporate images:
73
74![image](image.png)
75
76Or 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
93Format code snippets or other preformatted text. Just surround the code
94with `~~~~`. You can also trigger syntax highlighting by putting in
95the following HTML comment before the code section:
96
97    <!--?prettify?-->
98
99
100<!--?prettify?-->
101~~~~
102class SK_API SkPaint {
103public:
104    SkPaint();
105    SkPaint(const SkPaint& paint);
106    ~SkPaint();
107
108    SkPaint& operator=(const SkPaint&);
109~~~~
110
111
112Tables
113
114  Name    | Value    | Summary
115  --------|----------|--------
116  A       | 27       |  yes
117  B       | 23       |  no
118
119
120There are also inline styles for *emphasis*, **bold**,
121~~strikethrough~~, and `inline code`. Also small fractions,
122such as 1/2 are rendered nicely.
123
124> # There are
125> ## Headers
126> ### Up To
127> #### Six
128> ##### Levels
129> ###### Deep
130
131And you can <b>always</b> use HTML, which is useful for features that can't be
132done in MarkDown, such as iframes, but try to avoid using HTML outside of
133sitations 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
143Reference
144=========
145
146Below is a longer reference on the MarkDown that docserver accepts.
147
148Paragraphs
149----------
150
151A paragraph is simply one or more consecutive lines of text, separated
152by one or more blank lines. (A blank line is any line that looks like a
153blank line -- a line containing nothing spaces or tabs is considered
154blank.) Normal paragraphs should not be intended with spaces or tabs.
155
156Headers and Blockquotes
157-----------------------
158
159You can create headers by either "underlining" with equal signs (`=`) and hyphens (`-`),
160or,you can put 1-6 hash marks (`#`) at the
161beginning of the line -- the number of hashes equals the resulting
162HTML header level.
163
164Blockquotes are indicated using email-style '`>`' angle brackets.
165
166Markdown:
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
190Output:
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
217Markdown uses asterisks and underscores to indicate spans of emphasis.
218
219Markdown:
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
227Output:
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
239Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
240`+`, and `-`) as list markers. These three markers are
241interchangable; this:
242
243    *   Candy.
244    *   Gum.
245    *   Booze.
246
247this:
248
249    +   Candy.
250    +   Gum.
251    +   Booze.
252
253and this:
254
255    -   Candy.
256    -   Gum.
257    -   Booze.
258
259all produce the same output:
260
261    <ul>
262    <li>Candy.</li>
263    <li>Gum.</li>
264    <li>Booze.</li>
265    </ul>
266
267Ordered (numbered) lists use regular numbers, followed by periods, as
268list markers:
269
270    1.  Red
271    2.  Green
272    3.  Blue
273
274Output:
275
276    <ol>
277    <li>Red</li>
278    <li>Green</li>
279    <li>Blue</li>
280    </ol>
281
282If you put blank lines between items, you'll get `<p>` tags for the
283list item text. You can create multi-paragraph list items by indenting
284the 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
292Output:
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
304Markdown supports two styles for creating links: *inline* and
305*reference*. With both styles, you use square brackets to delimit the
306text you want to turn into a link.
307
308Inline-style links use parentheses immediately after the link text.
309For example:
310
311    This is an [example link](http://example.com/).
312
313Output:
314
315    <p>This is an <a href="http://example.com/">
316    example link</a>.</p>
317
318Optionally, you may include a title attribute in the parentheses:
319
320    This is an [example link](http://example.com/ "With a Title").
321
322Output:
323
324    <p>This is an <a href="http://example.com/" title="With a Title">
325    example link</a>.</p>
326
327Reference-style links allow you to refer to your links by names, which
328you 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
337Output:
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
344The title attribute is optional. Link names may contain letters,
345numbers 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
352Output:
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
360Image syntax is very much like link syntax.
361
362Inline (titles are optional):
363
364    ![alt text](/path/to/img.jpg "Title")
365
366Reference-style:
367
368    ![alt text][id]
369
370    [id]: /path/to/img.jpg "Title"
371
372Both 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
380In a regular paragraph, you can create code span by wrapping text in
381backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
382`>`) will automatically be translated into HTML entities. This makes
383it 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
390Output:
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
400To specify an entire block of pre-formatted code, indent every line of
401the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
402and `>` characters will be escaped automatically.
403
404Markdown:
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
413Output:
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