Debian Codegraph @

tests/output/app/gfm-test-user-content.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <title>README.md - Grip</title>
6 <link rel="icon" href="/__/grip/static/favicon.ico" />
7 <style>
8 /* Page tweaks */
9 .preview-page {
10 margin-top: 64px;
11 }
12 /* Discussion tweaks */
13 .discussion-timeline.wide {
14 width: 920px;
15 }
16 .timeline-comment-wrapper > .timeline-comment:after,
17 .timeline-comment-wrapper > .timeline-comment:before {
18 content: none;
19 }
20 </style>
21 </head>
22 <body>
23 <div class="page">
24 <div id="preview-page" class="preview-page" data-autorefresh-url="">
25 <div class="container">
26 <div class="repository-with-sidebar repo-container with-full-navigation">
27
28
29 <div class="discussion-timeline ">
30 <div class="timeline-comment-wrapper">
31 <div class="timeline-comment">
32 <div class="comment">
33 <div class="comment-content">
34 <div id="grip-content" class="comment-body markdown-body markdown-format">
35 <h1>GitHub Flavored Markdown Test</h1>
36
37 <p>This Markdown file contains all the features of <strong>GitHub Flavored Markdown</strong> for<br>
38 testing a renderer with.</p>
39
40 <p>The features are taken directly from <a href="https://daringfireball.net/projects/markdown/syntax">Daring Fireball</a><br>
41 and <a href="https://help.github.com/articles/github-flavored-markdown/">GitHub Flavored Markdown</a>,<br>
42 followed by a list of one-offs.</p>
43
44 <h2>Inline HTML</h2>
45
46 <table>
47 <tbody>
48 <tr>
49 <td>Foo</td>
50 </tr>
51 <tr>
52 <td>
53 Note that Markdown formatting syntax is not processed within block-level HTML tags.
54 E.g., you can’t use Markdown-style *emphasis* inside an HTML block.
55 </td>
56 </tr>
57 </tbody>
58 </table>
59
60 <p>Span-level HTML tags — e.g. &lt;span&gt;, &lt;cite&gt;, or &lt;del&gt; — can be used anywhere<br>
61 in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead<br>
62 of Markdown formatting; e.g. if you’d prefer to use HTML &lt;a&gt; or &lt;img&gt; tags instead<br>
63 of Markdown’s link or image syntax, go right ahead.</p>
64
65 <h4>Testing span, cite, and <del>del</del> tags</h4>
66
67 <p>Testing span, cite, and <del>del</del> tags in a paragraph.</p>
68
69 <p>And each element in its own list item:</p>
70
71 <ul>
72 <li>This is within a span tag.</li>
73 <li>This is within a cite tag.</li>
74 <li><del>This is within a del tag.</del></li>
75 </ul>
76
77 <h2>Automatic escaping for special characters</h2>
78
79 <ul>
80 <li>© copyright</li>
81 <li>AT&amp;T should render the same as AT&amp;T</li>
82 <li>4 &lt; 5 should render the same as 4 &lt; 5</li>
83 </ul>
84
85 <p>Note that GitHub Flavored Markdown has URL autolinking, which will <em>not</em><br>
86 convert <code>&amp;amp;</code>. So these two should yield different links:</p>
87
88 <ul>
89 <li><a href="http://images.google.com/images?num=30&amp;q=larry+bird">http://images.google.com/images?num=30&amp;q=larry+bird</a></li>
90 <li><a href="http://images.google.com/images?num=30&amp;amp;q=larry+bird">http://images.google.com/images?num=30&amp;amp;q=larry+bird</a></li>
91 </ul>
92
93 <h2>Paragraphs and line breaks</h2>
94
95 <p>This is a normal paragraph.</p>
96
97 <p>This and the next sentence is separated by a single newline.<br>
98 This should be on the same line.</p>
99
100 <p>This and the next sentence is joined by a single <code>&lt;br /&gt;</code>. <br><br>
101 This should be on a new line, directly below.</p>
102
103 <p>These two sentences are separated by two <code>&lt;br /&gt;</code> tags. <br><br><br>
104 This should be two lines below.</p>
105
106 <p>These two paragraphs are separated by two <code>&lt;br /&gt;</code> tags. <br><br></p>
107
108 <p>This should be three lines below.</p>
109
110 <h2>Headers</h2>
111
112 <p>Here are some headers followed by <a href="https://en.wikipedia.org/wiki/Lorem_ipsum">Lorem Ipsum</a>.</p>
113
114 <h1>This is an H1 (Setext-style)</h1>
115
116 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
117
118 <h2>This is an H2 (Setext-style)</h2>
119
120 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
121
122 <p>The following are atx-style.</p>
123
124 <h1>This is an H1</h1>
125
126 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
127
128 <h2>This is an H2</h2>
129
130 <p>Mauris feugiat, augue vitae sollicitudin vulputate, neque arcu dapibus eros, eget semper lorem ex rhoncus nulla.</p>
131
132 <h3>This is an H3</h3>
133
134 <p>Etiam sit amet orci sit amet dui mollis molestie.</p>
135
136 <h4>This is an H4</h4>
137
138 <p>Cras et elit egestas, lacinia est eu, vestibulum enim.</p>
139
140 <h5>This is an H5</h5>
141
142 <p>Phasellus sed suscipit quam.</p>
143
144 <h6>This is an H√36</h6>
145
146 <p>Nam rutrum imperdiet purus, sit amet porttitor augue tempor quis.</p>
147
148 <h2>Blockquotes</h2>
149
150 <p>Email-style blockquotes:</p>
151
152 <blockquote>
153 <p>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,<br>
154 consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.<br>
155 Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</p>
156
157 <p>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse<br>
158 id sem consectetuer libero luctus adipiscing.</p>
159 </blockquote>
160
161 <p>Putting the &gt; before the first line of a hard-wrapped paragraph:</p>
162
163 <blockquote>
164 <p>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,<br>
165 consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.<br>
166 Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.</p>
167
168 <p>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse<br>
169 id sem consectetuer libero luctus adipiscing.</p>
170 </blockquote>
171
172 <p>Nested blockquotes (i.e. a blockquote-in-a-blockquote):</p>
173
174 <blockquote>
175 <p>This is the first level of quoting.</p>
176
177 <blockquote>
178 <p>This is nested blockquote.</p>
179 </blockquote>
180
181 <p>Back to the first level.</p>
182 </blockquote>
183
184 <p>Blockquotes containing other Markdown elements:</p>
185
186 <blockquote>
187 <h2>This is a header.</h2>
188
189 <ol>
190 <li> This is the first list item.</li>
191 <li> This is the second list item.</li>
192 </ol>
193
194 <p>Here's some example code:</p>
195
196 <pre><code>return shell_exec("echo $input | $markdown_script");
197 </code></pre>
198 </blockquote>
199
200 <h2>Lists</h2>
201
202 <h5>These three lists should be equivalent</h5>
203
204 <p>First:</p>
205
206 <ul>
207 <li> Red</li>
208 <li> Green</li>
209 <li> Blue</li>
210 </ul>
211
212 <p>Second:</p>
213
214 <ul>
215 <li> Red</li>
216 <li> Green</li>
217 <li> Blue</li>
218 </ul>
219
220 <p>Third:</p>
221
222 <ul>
223 <li> Red</li>
224 <li> Green</li>
225 <li> Blue</li>
226 </ul>
227
228 <h4>These three ordered lists should be equivalent</h4>
229
230 <p>First:</p>
231
232 <ol>
233 <li> Bird</li>
234 <li> McHale</li>
235 <li> Parish</li>
236 </ol>
237
238 <p>Second:</p>
239
240 <ol>
241 <li> Bird</li>
242 <li> McHale</li>
243 <li> Parish</li>
244 </ol>
245
246 <p>Third:</p>
247
248 <ol>
249 <li>Bird</li>
250 <li>McHale</li>
251 <li>Parish</li>
252 </ol>
253
254 <h4>These two lists should be equivalent</h4>
255
256 <p>First:</p>
257
258 <ul>
259 <li> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
260 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
261 viverra nec, fringilla in, laoreet vitae, risus.</li>
262 <li> Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
263 Suspendisse id sem consectetuer libero luctus adipiscing.</li>
264 </ul>
265
266 <p>Second:</p>
267
268 <ul>
269 <li> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
270 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
271 viverra nec, fringilla in, laoreet vitae, risus.</li>
272 <li> Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
273 Suspendisse id sem consectetuer libero luctus adipiscing.</li>
274 </ul>
275
276 <h4>Paragraphs and lists</h4>
277
278 <ul>
279 <li> Bird</li>
280 <li> Magic</li>
281 </ul>
282
283 <p>Blank line separated:</p>
284
285 <ul>
286 <li><p>Bird</p></li>
287 <li><p>Magic</p></li>
288 </ul>
289
290 <h4>Paragraphs within lists</h4>
291
292 <p>First:</p>
293
294 <ol>
295 <li>
296 <p>This is a list item with two paragraphs. Lorem ipsum dolor<br>
297 sit amet, consectetuer adipiscing elit. Aliquam hendrerit<br>
298 mi posuere lectus.</p>
299
300 <p>Vestibulum enim wisi, viverra nec, fringilla in, laoreet<br>
301 vitae, risus. Donec sit amet nisl. Aliquam semper ipsum<br>
302 sit amet velit.</p>
303 </li>
304 <li><p>Suspendisse id sem consectetuer libero luctus adipiscing.</p></li>
305 </ol>
306
307 <p>Second:</p>
308
309 <ul>
310 <li>
311 <p>This is a list item with two paragraphs.</p>
312
313 <p>This is the second paragraph in the list item. You're<br>
314 only required to indent the first line. Lorem ipsum dolor<br>
315 sit amet, consectetuer adipiscing elit.</p>
316 </li>
317 <li><p>Another item in the same list.</p></li>
318 </ul>
319
320 <h4>Blockquote within a list</h4>
321
322 <ul>
323 <li>
324 <p>A list item with a blockquote:</p>
325
326 <blockquote>
327 <p>This is a blockquote<br>
328 inside a list item.</p>
329 </blockquote>
330 </li>
331 </ul>
332
333 <h4>Code within a list</h4>
334
335 <ul>
336 <li>
337 <p>A list item with a code block:</p>
338
339 <pre><code>&lt;code goes here&gt;
340 </code></pre>
341 </li>
342 </ul>
343
344 <h4>Accidental lists</h4>
345
346 <ol>
347 <li>What a great season. (oops, I wanted a year, not a list)</li>
348 </ol>
349
350 <p>1986. What a great season. (<em>whew!</em> there we go)</p>
351
352 <h2>Code blocks</h2>
353
354 <p>This is a normal paragraph:</p>
355
356 <pre><code>This is a code block.
357 </code></pre>
358
359 <p>Here is an example of AppleScript:</p>
360
361 <pre><code>tell application "Foo"
362 beep
363 end tell
364 </code></pre>
365
366 <p>Markdown will handle the hassle of encoding the ampersands and angle brackets:</p>
367
368 <pre><code>&lt;div class="footer"&gt;
369 &amp;copy; 2004 Foo Corporation
370 &lt;/div&gt;
371
372
373 def this_is
374 puts "some #{4-space-indent} code"
375 end
376 </code></pre>
377
378 <p><code><br>
379 print('Code block')<br>
380 </code></p>
381
382 <pre>print('Pre block')
383 </pre>
384
385 <h2>Horizontal rules</h2>
386
387 <hr>
388
389 <hr>
390
391 <hr>
392
393 <hr>
394
395 <hr>
396
397 <h2>Links</h2>
398
399 <p>Markdown supports two style of links: inline and reference.</p>
400
401 <p>This is <a href="http://joeyespo.com/" title="Title">an example</a> inline link.</p>
402
403 <p><a href="http://joeyespo.com/">This link</a> has no title attribute.</p>
404
405 <p>See my <a href="/about/">About</a> page for some awesome people (<em>note: broken link</em>).</p>
406
407 <p>This is <a href="http://joeyespo.com/" title="Optional Title Here">an example</a> reference-style link.<br>
408 This is <a href="http://joeyespo.com/" title="Optional Title Here">an example</a> reference-style link with a space separating the brackets.</p>
409
410 <p>These should all be equivalent:</p>
411
412 <ul>
413 <li><a href="http://joeyespo.com/" title="Optional Title Here">foo 1</a></li>
414 <li><a href="http://joeyespo.com/" title="Optional Title Here">foo 2</a></li>
415 <li><a href="http://joeyespo.com/" title="Optional Title Here">foo 3</a></li>
416 <li><a href="http://joeyespo.com/" title="Optional Title Here">foo 4</a></li>
417 <li><a href="http://joeyespo.com/" title="Optional Title Here">foo 5</a></li>
418 </ul>
419
420 <h2>Emphasis</h2>
421
422 <ul>
423 <li><em>single asterisks</em></li>
424 <li><em>single underscores</em></li>
425 <li><strong>double asterisks</strong></li>
426 <li><strong>double underscores</strong></li>
427 <li>un<em>frigging</em>believable</li>
428 <li>*this text is surrounded by literal asterisks*</li>
429 </ul>
430
431 <h2>Code</h2>
432
433 <ul>
434 <li>Use the <code>printf()</code> function.</li>
435 <li><code>There is a literal backtick (`) here.</code></li>
436 <li>A single backtick in a code span: <code>`</code>
437 </li>
438 <li>A backtick-delimited string in a code span: <code>`foo`</code>
439 </li>
440 <li>Please don't use any <code>&lt;blink&gt;</code> tags.</li>
441 <li>
442 <code>&amp;#8212;</code> is the decimal-encoded equivalent of <code>&amp;mdash;</code>
443 </li>
444 </ul>
445
446 <h2>Images</h2>
447
448 <ul>
449 <li><a href="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" target="_blank"><img src="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" alt="Alt text" style="max-width:100%;"></a></li>
450 <li><a href="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" target="_blank"><img src="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" alt="Alt text" title="Optional title" style="max-width:100%;"></a></li>
451 <li><a href="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" target="_blank"><img src="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" alt="Alt text" title="Optional title attribute" style="max-width:100%;"></a></li>
452 <li>
453 <a href="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" target="_blank"><img src="https://raw.githubusercontent.com/joeyespo/grip/master/artwork/favicon.ico" width="32" height="32" style="max-width:100%;"></a>   ← bigger &amp; blurrier</li>
454 </ul>
455
456 <h2>Automatic links</h2>
457
458 <ul>
459 <li><a href="http://joeyespo.com/">http://joeyespo.com/</a></li>
460 <li><a href="mailto:[email protected]">[email protected]</a></li>
461 </ul>
462
463 <h2>Backslash escapes</h2>
464
465 <ul>
466 <li>*literal asterisks*</li>
467 <li>\ backslash</li>
468 <li>` backtick</li>
469 <li>* asterisk</li>
470 <li>_ underscore</li>
471 <li>{} curly braces</li>
472 <li>[] square brackets</li>
473 <li>() parentheses</li>
474 <li># hash mark</li>
475 <li>+ plus sign</li>
476 <li>- minus sign (hyphen)</li>
477 <li>. dot</li>
478 <li>! exclamation mark</li>
479 </ul>
480
481 <h2>GitHub Flavored Markdown</h2>
482
483 <p>See <a href="https://help.github.com/articles/github-flavored-markdown/">GitHub Flavored Markdown</a> for details.</p>
484
485 <h4>Multiple underscores in words</h4>
486
487 <ul>
488 <li>wow_great_stuff</li>
489 </ul>
490
491 <h4>URL autolinking</h4>
492
493 <p><a href="http://joeyespo.com">http://joeyespo.com</a></p>
494
495 <h4>Strikethrough</h4>
496
497 <p><del>Mistaken text.</del></p>
498
499 <h4>Fenced code blocks</h4>
500
501 <pre><code>function test() {
502 console.log("notice the blank line before this function?");
503 }
504 </code></pre>
505
506 <h4>Syntax highlighting</h4>
507
508 <div class="highlight highlight-source-python"><pre><span class="pl-k">print</span>(<span class="pl-s"><span class="pl-pds">'</span>Hello!<span class="pl-pds">'</span></span>)</pre></div>
509
510 <div class="highlight highlight-source-js"><pre><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">'</span>JavaScript!<span class="pl-pds">'</span></span>);</pre></div>
511
512 <div class="highlight highlight-source-js"><pre><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">'</span>JavaScript (with js)!<span class="pl-pds">'</span></span>);</pre></div>
513
514 <pre lang="unmatched_language"><code>console.log('No matching language, but looks like JavaScript.');
515 </code></pre>
516
517 <h4>Tables</h4>
518
519 <p>Simple:</p>
520
521 <table>
522 <thead>
523 <tr>
524 <th>First Header</th>
525 <th>Second Header</th>
526 </tr>
527 </thead>
528 <tbody>
529 <tr>
530 <td>Content Cell</td>
531 <td>Content Cell</td>
532 </tr>
533 <tr>
534 <td>Content Cell</td>
535 <td>Content Cell</td>
536 </tr>
537 </tbody>
538 </table>
539
540 <p>Pipes:</p>
541
542 <table>
543 <thead>
544 <tr>
545 <th>First Header</th>
546 <th>Second Header</th>
547 </tr>
548 </thead>
549 <tbody>
550 <tr>
551 <td>Content Cell</td>
552 <td>Content Cell</td>
553 </tr>
554 <tr>
555 <td>Content Cell</td>
556 <td>Content Cell</td>
557 </tr>
558 </tbody>
559 </table>
560
561 <p>Unmatched:</p>
562
563 <table>
564 <thead>
565 <tr>
566 <th>Name</th>
567 <th>Description</th>
568 </tr>
569 </thead>
570 <tbody>
571 <tr>
572 <td>Help</td>
573 <td>Display the help window.</td>
574 </tr>
575 <tr>
576 <td>Close</td>
577 <td>Closes a window</td>
578 </tr>
579 </tbody>
580 </table>
581
582 <p>Inner Markdown:</p>
583
584 <table>
585 <thead>
586 <tr>
587 <th>Name</th>
588 <th>Description</th>
589 </tr>
590 </thead>
591 <tbody>
592 <tr>
593 <td>Help</td>
594 <td>
595 <del>Display the</del> help window.</td>
596 </tr>
597 <tr>
598 <td>Close</td>
599 <td>
600 <em>Closes</em> a window</td>
601 </tr>
602 </tbody>
603 </table>
604
605 <p>Alignment:</p>
606
607 <table>
608 <thead>
609 <tr>
610 <th align="left">Left-Aligned</th>
611 <th align="center">Center Aligned</th>
612 <th align="right">Right Aligned</th>
613 </tr>
614 </thead>
615 <tbody>
616 <tr>
617 <td align="left">col 3 is</td>
618 <td align="center">some wordy text</td>
619 <td align="right">$1600</td>
620 </tr>
621 <tr>
622 <td align="left">col 2 is</td>
623 <td align="center">centered</td>
624 <td align="right">$12</td>
625 </tr>
626 <tr>
627 <td align="left">zebra stripes</td>
628 <td align="center">are neat</td>
629 <td align="right">$1</td>
630 </tr>
631 </tbody>
632 </table>
633
634 <p>Text right below a table.</p>
635
636 <h4>HTML</h4>
637
638 <p><em>TODO: Test all allowed HTML tags.</em></p>
639
640 <h2>Writing on GitHub</h2>
641
642 <p>See <a href="https://help.github.com/articles/writing-on-github/">this article</a> for details.</p>
643
644 <h4>Newlines</h4>
645
646 <p>Roses are red<br>
647 Violets are Blue</p>
648
649 <h4>Task lists</h4>
650
651 <ul class="task-list">
652 <li class="task-list-item">
653 <input type="checkbox" class="task-list-item-checkbox" checked disabled> <a href="https://github.com/blog/821" class="user-mention">@mentions</a>, #refs, <a href="">links</a>, <strong>formatting</strong>, and <del>tags</del> are supported</li>
654 <li class="task-list-item">
655 <input type="checkbox" class="task-list-item-checkbox" checked disabled> list syntax is required (any unordered or ordered list supported)</li>
656 <li class="task-list-item">
657 <input type="checkbox" class="task-list-item-checkbox" checked disabled> this is a complete item</li>
658 <li class="task-list-item">
659 <input type="checkbox" class="task-list-item-checkbox" disabled> this is an incomplete item</li>
660 </ul>
661
662 <p>Task lists can be nested to better structure your tasks:</p>
663
664 <ul class="task-list">
665 <li class="task-list-item">
666 <input type="checkbox" class="task-list-item-checkbox" disabled> a bigger project
667
668 <ul class="task-list">
669 <li class="task-list-item">
670 <input type="checkbox" class="task-list-item-checkbox" checked disabled> first subtask #1234</li>
671 <li class="task-list-item">
672 <input type="checkbox" class="task-list-item-checkbox" disabled> follow up subtask #4321</li>
673 <li class="task-list-item">
674 <input type="checkbox" class="task-list-item-checkbox" disabled> final subtask cc <a href="https://github.com/blog/821" class="user-mention">@mention</a>
675 </li>
676 </ul>
677 </li>
678 <li class="task-list-item">
679 <input type="checkbox" class="task-list-item-checkbox" checked disabled> a separate task</li>
680 </ul>
681
682 <h4>References</h4>
683
684 <ul>
685 <li>SHA: dbcd7a410ee7489acf92f40641a135fbcf52a768</li>
686 <li>User@SHA: joeyespo@dbcd7a410ee7489acf92f40641a135fbcf52a768</li>
687 <li>User/Repository@SHA: <a href="https://github.com/joeyespo/grip/commit/dbcd7a410ee7489acf92f40641a135fbcf52a768" class="commit-link">joeyespo/grip@<tt>dbcd7a4</tt></a>
688 </li>
689 <li>#Num: #135</li>
690 <li>GH-Num: GH-135</li>
691 <li>User#Num: joeyespo#135</li>
692 <li>User/Repository#Num: <a href="https://github.com/joeyespo/grip/pull/135" class="issue-link" title="Add autorefresh">joeyespo/grip#135</a>
693 </li>
694 </ul>
695 </div>
696 </div>
697 </div>
698 </div>
699 </div>
700 </div>
701
702
703 </div>
704 </div>
705 </div>
706 <div>&nbsp;</div>
707 </div><script>
708 function showCanonicalImages() {
709 var images = document.getElementsByTagName('img');
710 if (!images) {
711 return;
712 }
713 for (var index = 0; index < images.length; index++) {
714 var image = images[index];
715 if (image.getAttribute('data-canonical-src') && image.src !== image.getAttribute('data-canonical-src')) {
716 image.src = image.getAttribute('data-canonical-src');
717 }
718 }
719 }
720
721 function scrollToHash() {
722 if (location.hash && !document.querySelector(':target')) {
723 var element = document.getElementById('user-content-' + location.hash.slice(1));
724 if (element) {
725 element.scrollIntoView();
726 }
727 }
728 }
729
730 function autorefreshContent(eventSourceUrl) {
731 var initialTitle = document.title;
732 var contentElement = document.getElementById('grip-content');
733 var source = new EventSource(eventSourceUrl);
734 var isRendering = false;
735
736 source.onmessage = function(ev) {
737 var msg = JSON.parse(ev.data);
738 if (msg.updating) {
739 isRendering = true;
740 document.title = '(Rendering) ' + document.title;
741 } else {
742 isRendering = false;
743 document.title = initialTitle;
744 contentElement.innerHTML = msg.content;
745 showCanonicalImages();
746 }
747 }
748
749 source.onerror = function(e) {
750 if (e.readyState === EventSource.CLOSED && isRendering) {
751 isRendering = false;
752 document.title = initialTitle;
753 }
754 }
755 }
756
757 window.onhashchange = function() {
758 scrollToHash();
759 }
760
761 window.onload = function() {
762 scrollToHash();
763 }
764
765 showCanonicalImages();
766
767 var autorefreshUrl = document.getElementById('preview-page').getAttribute('data-autorefresh-url');
768 if (autorefreshUrl) {
769 autorefreshContent(autorefreshUrl);
770 }
771 </script>
772 </body>
773 </html>