Changeset View
Changeset View
Standalone View
Standalone View
autotests/input/test.markdown
1 | --- | ||||
---|---|---|---|---|---|
2 | Title: A Sample Markdown Document | ||||
3 | Author: Fletcher T. Penney | ||||
4 | Date: February 9, 2011 | ||||
5 | Comment: This is a comment intended to demonstrate | ||||
6 | metadata that spans multiple lines. | ||||
7 | --- | ||||
8 | | ||||
1 | # H1 | 9 | # H1 | ||
2 | 10 | | |||
3 | ## H2 | 11 | ## H2 | ||
4 | 12 | | |||
5 | ### H3 | 13 | ### H3 | ||
6 | 14 | | |||
7 | Multi-line paragraph bla bla bla | 15 | Multi-line paragraph bla bla bla | ||
8 | bla bla bla. | 16 | bla bla bla. | ||
9 | 17 | | |||
10 | Intentional line break | 18 | Intentional line break | ||
11 | via two spaces at line. | 19 | via two spaces at line. | ||
12 | 20 | | |||
13 | Formats: _italic_, **bold**, `monospace`, ~~strikeout~~ | 21 | Formats: _italic_, **bold**, `monospace`, ~~strikeout~~ | ||
14 | 22 | | |||
15 | Bullet list: | 23 | Bullet list: | ||
16 | 24 | | |||
17 | * item1 | 25 | * item1 | ||
18 | * item2 | 26 | * item2 | ||
19 | 27 | | |||
20 | Numbered list: | 28 | Numbered list: | ||
21 | 29 | | |||
22 | 1. item 1 | 30 | 1. item 1 | ||
23 | 2. item 2 | 31 | 2. item 2 | ||
24 | 32 | | |||
33 | Task list: | ||||
34 | | ||||
35 | - [x] Finish my changes | ||||
36 | - [ ] Push my commits | ||||
37 | - [ ] Open a pull request | ||||
38 | | ||||
39 | A link as normal text: http://example.com | ||||
40 | | ||||
25 | [link](http://kde.org) | 41 | [link](http://kde.org) | ||
26 | 42 | | |||
43 | Auto-link: <http://kate-editor.org> | ||||
44 | Mail: <mailto:mark@kde.org> | ||||
45 | | ||||
46 | This is [an example](http://example.com/ "Title") inline link. | ||||
47 | | ||||
48 | See my [About](/about/) page for details. | ||||
49 | | ||||
50 | This is [an example] [id] reference-style link. | ||||
51 | | ||||
52 | [id]: http://example.com/ "Optional Title Here" | ||||
53 | [foo]: http://example.com/ 'Optional Title Here' | ||||
54 | [bar]: http://example.com/ (Optional Title Here) | ||||
55 | [id2]: <http://example.com/> "Optional Title Here" | ||||
56 | | ||||
57 | ![Alt text](/path/to/img.jpg) | ||||
58 | | ||||
59 | ![Alt text](/path/to/img.jpg "Optional title") | ||||
60 | | ||||
61 | [![Alt text](https://url/to/img.svg)](https://link.com/example/) | ||||
62 | | ||||
27 | code 1 | 63 | code 1 | ||
28 | code 2 | 64 | code 2 | ||
29 | 65 | | |||
30 | normal text | 66 | normal text | ||
31 | 67 | | |||
32 | > block quote _italic_ | 68 | > block quote _italic_ | ||
33 | > more block quote | 69 | > more block quote | ||
34 | 70 | | |||
35 | normal text | 71 | normal text | ||
36 | 72 | | |||
37 | Title: some text | 73 | Title: some text | ||
38 | 74 | | |||
39 | normal text | 75 | normal text | ||
40 | 76 | | |||
77 | # Lists | ||||
78 | | ||||
79 | 1. item | ||||
80 | * This is a list item | ||||
81 | with multiple lines. | ||||
82 | ``` | ||||
83 | code | ||||
84 | ``` | ||||
85 | | ||||
86 | > This is a | ||||
87 | blockquote | ||||
88 | | ||||
89 | This is a new paragraph, which | ||||
90 | is part of the item in the | ||||
91 | previous list. | ||||
92 | | ||||
93 | indented code block | ||||
94 | | ||||
95 | Other paragraph. | ||||
96 | | ||||
97 | * subitem | ||||
98 | * subitem | ||||
99 | with multiple | ||||
100 | lines. | ||||
101 | | ||||
102 | New paragraph of | ||||
103 | the previous subitem. | ||||
104 | | ||||
105 | code block | ||||
106 | | ||||
107 | ----------------------- | ||||
108 | | ||||
109 | Other paragraph of | ||||
110 | the subitem. | ||||
111 | | ||||
112 | 30. numlist item | ||||
113 | 31. numlist item | ||||
114 | | ||||
115 | New paragraph of | ||||
116 | the previous item. | ||||
117 | | ||||
118 | > Blockquote | ||||
119 | | ||||
120 | code block | ||||
121 | | ||||
122 | Other paragraph. | ||||
123 | | ||||
124 | # Inline HTML | ||||
125 | | ||||
126 | © | ||||
127 | <strong>bold</strong> | ||||
128 | <code>code</code> | ||||
129 | | ||||
130 | <table> | ||||
131 | <tr> | ||||
132 | <th>a</th> | ||||
133 | <th>b</th> | ||||
134 | </tr> | ||||
135 | <tr> | ||||
136 | <th><ul> | ||||
137 | <li>c</li> | ||||
138 | <li>d</li> | ||||
139 | </ul></th> | ||||
140 | <th>e</th> | ||||
141 | </tr> | ||||
142 | </table> | ||||
143 | | ||||
144 | normal text *italic* | ||||
145 | | ||||
146 | # Code | ||||
147 | | ||||
148 | `simple code` | ||||
149 | | ||||
150 | ``simple ` code`` | ||||
151 | | ||||
152 | ```simple `` ` code ``` | ||||
153 | | ||||
154 | ````simple`code```` | ||||
155 | | ||||
156 | normal text | ||||
157 | normal text | ||||
158 | normal text | ||||
159 | normal text | ||||
160 | | ||||
161 | code blocks are only allowed | ||||
162 | after an empty line. | ||||
163 | | ||||
164 | * list | ||||
165 | list | ||||
166 | | ||||
167 | normal text | ||||
168 | | ||||
169 | 1. num-list | ||||
170 | num-list | ||||
171 | | ||||
172 | normal text | ||||
173 | | ||||
174 | > quote | ||||
175 | quote | ||||
176 | | ||||
177 | code block | ||||
178 | | ||||
179 | normal | ||||
180 | <!-- comment --> | ||||
181 | <!-- code, not comment --> | ||||
182 | code | ||||
183 | | ||||
184 | normal | ||||
185 | | ||||
186 | <!-- coment --> | ||||
187 | code | ||||
188 | | ||||
41 | # Fenced code blocks (bug 356974) | 189 | # Fenced code blocks (bug 356974) | ||
42 | 190 | | |||
43 | ## Bash | 191 | ## Bash | ||
44 | 192 | | |||
45 | ```bash | 193 | ```bash | ||
46 | #!/usr/bin/env bash | 194 | #!/usr/bin/env bash | ||
47 | 195 | | |||
48 | for f in *; do | 196 | for f in *; do | ||
Show All 11 Lines | |||||
60 | public: | 208 | public: | ||
61 | Q(); | 209 | Q(); | ||
62 | } | 210 | } | ||
63 | 211 | | |||
64 | Q::Q() :QObject(NULL) { | 212 | Q::Q() :QObject(NULL) { | ||
65 | } | 213 | } | ||
66 | ``` | 214 | ``` | ||
67 | 215 | | |||
216 | ## C | ||||
217 | | ||||
218 | ```c | ||||
219 | #include <stdio.h> | ||||
220 | #include "stdint.h" | ||||
221 | #define SOME_VAR 1 | ||||
222 | | ||||
223 | static uint64_t intWithSuffix = 42ull + ~1233L; | ||||
224 | static int octNum = 07232; | ||||
225 | ``` | ||||
226 | | ||||
227 | ## C# ## | ||||
228 | | ||||
229 | ```csharp | ||||
230 | var arr = new[] { 0, 1, 2, 3, 4 }; | ||||
231 | var anon = new { Country = "Germany", Inhabitants = 80000000 }; | ||||
232 | ``` | ||||
233 | | ||||
68 | ## CMake | 234 | ## CMake | ||
69 | 235 | | |||
70 | ```cmake | 236 | ```cmake | ||
71 | cmake_minimum_required(VERSION 3.10 FATAL_ERROR) | 237 | cmake_minimum_required(VERSION 3.10 FATAL_ERROR) | ||
72 | 238 | | |||
73 | project (hello_world) | 239 | project (hello_world) | ||
74 | 240 | | |||
75 | set(QT_MIN_VERSION "5.6.0") | 241 | set(QT_MIN_VERSION "5.6.0") | ||
Show All 11 Lines | |||||
87 | 253 | ||||
88 | 254 | | |||
89 | 255 | ||||
90 | From: Konqi Dragon <konqi@kde.org> | 256 | From: Konqi Dragon <konqi@kde.org> | ||
91 | To: All <all@kde.og> | 257 | To: All <all@kde.og> | ||
92 | Subject: highlights | 258 | Subject: highlights | ||
93 | ``` | 259 | ``` | ||
94 | 260 | | |||
261 | ## Go | ||||
262 | | ||||
263 | ```go | ||||
264 | package main | ||||
265 | | ||||
266 | import "fmt" | ||||
267 | | ||||
268 | func main() { | ||||
269 | fmt.Println("Hola, mundo.") | ||||
270 | } | ||||
271 | ``` | ||||
272 | | ||||
95 | ## Haskell | 273 | ## Haskell | ||
96 | 274 | | |||
97 | ```haskell | 275 | ```haskell | ||
98 | module Main (main) where | 276 | module Main (main) where | ||
99 | 277 | | |||
100 | main :: IO () | 278 | main :: IO () | ||
101 | main = putStrLn "Hello, World!" | 279 | main = putStrLn "Hello, World!" | ||
102 | ``` | 280 | ``` | ||
103 | 281 | | |||
104 | ## HTML | 282 | ## HTML | ||
105 | 283 | | |||
106 | ```html | 284 | ```html | ||
107 | <html> | 285 | <html> | ||
108 | <body> | 286 | <body> | ||
109 | <p class="main">Hello world!</p> | 287 | <p class="main">Hello world!</p> | ||
110 | </body> | 288 | </body> | ||
111 | </html> | 289 | </html> | ||
112 | ``` | 290 | ``` | ||
113 | 291 | | |||
292 | ## Java | ||||
293 | | ||||
294 | ```java | ||||
295 | package fibsandlies; | ||||
296 | import java.util.HashMap; | ||||
297 | | ||||
298 | /** | ||||
299 | * This is an example of a Javadoc comment; Javadoc can compile documentation | ||||
300 | * from this text. Javadoc comments must immediately precede the class, method, or field being documented. | ||||
301 | */ | ||||
302 | public class FibCalculator extends Fibonacci implements Calculator { | ||||
303 | | ||||
304 | private static Map<Integer, Integer> memoized = new HashMap<Integer, Integer>(); | ||||
305 | public static void main(String[] args) { | ||||
306 | memoized.put(1, 1); | ||||
307 | memoized.put(2, 1); | ||||
308 | System.out.println(fibonacci(12)); | ||||
309 | } | ||||
310 | } | ||||
311 | ``` | ||||
312 | | ||||
313 | ## JavaScript | ||||
314 | | ||||
315 | ```js | ||||
316 | function factorial(n) { | ||||
317 | if (n === 0) { | ||||
318 | return 1; // 0! = 1 | ||||
319 | } | ||||
320 | return n * factorial(n - 1); | ||||
321 | } | ||||
322 | ``` | ||||
323 | | ||||
324 | ## JavaScript React (JSX) | ||||
325 | | ||||
326 | ```jsx | ||||
327 | <hello /> | ||||
328 | function Story(props) { | ||||
329 | const SpecificStory = components[props.storyType]; | ||||
330 | return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />; | ||||
331 | } | ||||
332 | ``` | ||||
333 | | ||||
114 | ## JSON | 334 | ## JSON | ||
115 | 335 | | |||
116 | ```json | 336 | ```json | ||
117 | [{ | 337 | [{ | ||
118 | "hello": "world", | 338 | "hello": "world", | ||
119 | "count": 1, | 339 | "count": 1, | ||
120 | "bool": true | 340 | "bool": true | ||
121 | }] | 341 | }] | ||
122 | ``` | 342 | ``` | ||
123 | 343 | | |||
124 | ## KConfig | 344 | ## Matlab | ||
345 | | ||||
346 | ```matlab | ||||
347 | % Numbers _____________________________________________ | ||||
348 | 5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i | ||||
349 | 5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i' | ||||
350 | ``` | ||||
351 | | ||||
352 | ## Markdown | ||||
353 | | ||||
354 | ```markdown | ||||
355 | **bold** `code` | ||||
356 | > quote | ||||
357 | | ||||
358 | ``` | ||||
359 | | ||||
360 | ## Mustache/Handlebars | ||||
361 | | ||||
362 | ```handlebars | ||||
363 | {{#movie}} | ||||
364 | <div> | ||||
365 | <h1>{{title}}</h1> | ||||
366 | <img src="{{poster}}" alt="{{title}}"/> | ||||
367 | </div> | ||||
368 | <div> | ||||
369 | Rating - {{ratings.critics_rating}} | ||||
370 | </div> | ||||
371 | {{/movie}} | ||||
372 | ``` | ||||
373 | | ||||
374 | ## Perl | ||||
375 | | ||||
376 | ```perl | ||||
377 | my $var = shift; | ||||
125 | 378 | | |||
126 | ```kconfig | 379 | $var =~ s/bla/foo/igs; | ||
127 | [General] | 380 | $var =~ s!bla!foo!igs; | ||
128 | Toggle=true | 381 | $var =~ s#bla#foo#igs; | ||
129 | Count=1 | | |||
130 | ``` | 382 | ``` | ||
131 | 383 | | |||
132 | ## PHP | 384 | ## PHP | ||
133 | 385 | | |||
134 | ```php | 386 | ```php | ||
135 | namespace Application\Controller; | 387 | namespace Application\Controller; | ||
136 | 388 | | |||
137 | use Zend\Mvc\Controller\AbstractActionController; | 389 | use Zend\Mvc\Controller\AbstractActionController; | ||
Show All 16 Lines | |||||
154 | ```qml | 406 | ```qml | ||
155 | Text { | 407 | Text { | ||
156 | id: hello | 408 | id: hello | ||
157 | width: 100 | 409 | width: 100 | ||
158 | text: "Hello world!" | 410 | text: "Hello world!" | ||
159 | } | 411 | } | ||
160 | ``` | 412 | ``` | ||
161 | 413 | | |||
414 | ## R | ||||
415 | | ||||
416 | ```r | ||||
417 | # Declare function “f” with parameters “x”, “y“ | ||||
418 | # that returns a linear combination of x and y. | ||||
419 | f <- function(x, y) { | ||||
420 | z <- 3 * x + 4 * y | ||||
421 | return(z) | ||||
422 | } | ||||
423 | ``` | ||||
424 | | ||||
425 | ## Ruby | ||||
426 | | ||||
427 | ```ruby | ||||
428 | require 'Config' | ||||
429 | def CGI::escape(string) | ||||
430 | string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do | ||||
431 | '%' + $1.unpack('H2' * $1.size).join('%').upcase | ||||
432 | end.tr(' ', '+') | ||||
433 | end | ||||
434 | ``` | ||||
435 | | ||||
162 | ## Rust | 436 | ## Rust | ||
163 | 437 | | |||
164 | ```rust | 438 | ```rust | ||
165 | fn main() { | 439 | fn main() { | ||
166 | println!("Hello world!"); | 440 | println!("Hello world!"); | ||
167 | } | 441 | } | ||
168 | ``` | 442 | ``` | ||
169 | 443 | | |||
444 | ## MySQL | ||||
445 | | ||||
446 | ```mysql | ||||
447 | -- comment | ||||
448 | CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar); | ||||
449 | SELECT * FROM stuff WHERE id = 'string'; | ||||
450 | select * from stuff where id < 0.42; | ||||
451 | Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL; | ||||
452 | ``` | ||||
453 | | ||||
454 | ## TypeScript | ||||
455 | | ||||
456 | ```ts | ||||
457 | class Student { | ||||
458 | fullName: string; | ||||
459 | constructor(public firstName: string, public middleInitial: string, public lastName: string) { | ||||
460 | this.fullName = firstName + " " + middleInitial + " " + lastName; | ||||
461 | } | ||||
462 | } | ||||
463 | ``` | ||||
464 | | ||||
170 | ## XML | 465 | ## XML | ||
171 | 466 | | |||
172 | ```xml | 467 | ```xml | ||
173 | <tag attribute="3"> | 468 | <tag attribute="3"> | ||
174 | <nested/> | 469 | <nested/> | ||
175 | </tag> | 470 | </tag> | ||
176 | ``` | 471 | ``` | ||
177 | 472 | | |||
473 | ## reStructuredText | ||||
474 | | ||||
475 | ```rst | ||||
476 | Section Header | ||||
477 | ============== | ||||
478 | | ||||
479 | .. image:: /path/to/image.jpg | ||||
480 | | ||||
481 | - A bullet list item | ||||
482 | ``` | ||||
483 | | ||||
484 | ## Doxygen | ||||
485 | | ||||
486 | ```doxygen | ||||
487 | a normal member taking two arguments and returning an integer value. | ||||
488 | @param a an integer argument. | ||||
489 | @param s a constant character pointer. | ||||
490 | @see Javadoc_Test() | ||||
491 | @see publicVar() | ||||
492 | @return The test results | ||||
493 | ``` | ||||
494 | | ||||
178 | ## No language specified | 495 | ## No language specified | ||
179 | 496 | | |||
180 | ``` | 497 | ``` | ||
181 | No language is specified, but it should be still rendered as code block. | 498 | No language is specified, but it should be still rendered as code block. | ||
182 | ``` | 499 | ``` | ||
500 | | ||||
501 | # Fenced code blocks with more than 3 backticks or tildes | ||||
502 | | ||||
503 | ~~~ | ||||
504 | Fenced code block with 3 tildes. | ||||
505 | ~~~ | ||||
506 | | ||||
507 | ````````` | ||||
508 | Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes. | ||||
509 | ``` | ||||
510 | The block ends with the same amount of backticks. | ||||
511 | ````````` | ||||
512 | | ||||
513 | ~~~~~~~~~~~~ | ||||
514 | Fenced code block with more tildes. | ||||
515 | ~~~~~~~~~~~~ | ||||
516 | | ||||
517 | ## With languages | ||||
518 | | ||||
519 | ```````html | ||||
520 | <html> | ||||
521 | <body> | ||||
522 | <p class="main">Hello world!</p> | ||||
523 | </body> | ||||
524 | </html> | ||||
525 | ``` <!-- <= doesn't end here --> | ||||
526 | ``````` | ||||
527 | | ||||
528 | ~~~bash | ||||
529 | for f in *; do | ||||
530 | echo "$f" | ||||
531 | done | ||||
532 | ~~~ | ||||
533 | | ||||
534 | ~~~~~~~~~python | ||||
535 | def addXToY(x, y): | ||||
536 | total = x + y | ||||
537 | print total | ||||
538 | ~~~ # <= doesn't end here | ||||
539 | ~~~~~~~~~ | ||||
540 | | ||||
541 | # Italic and bold text | ||||
542 | | ||||
543 | **b** *i* __b__ _i_ | ||||
544 | ***ib*** ___ib___ | ||||
545 | **_ib_** __*ib*__ | ||||
546 | | ||||
547 | * _italic_ **bold** ***ib*** ~~strikeout~~ | ||||
548 | | ||||
549 | > _italic_ **bold** ***ib*** ~~strikeout~~ | ||||
550 | | ||||
551 | ## Bold | ||||
552 | **bold*___text** normal | ||||
553 | __bold_***text__ normal | ||||
554 | | ||||
555 | ## Italic | ||||
556 | *italic _ text* normal | ||||
557 | _italic * text_ normal | ||||
558 | | ||||
559 | ## Italic-Bold | ||||
560 | ***italic-bold ** italic-bold*** normal | ||||
561 | ***bold-italic text **bold-italic text*** normal | ||||
562 | ***bold*italic*** normal | ||||
563 | **_bold-italic text_** normal | ||||
564 | | ||||
565 | <!-- A non-space character is required after or before * or _ --> | ||||
566 | _ normal text_ * normal text * | ||||
567 | *italic text*normal text* | ||||
568 | *italic text *italic text* | ||||
569 | **bold text**normal text** | ||||
570 | **bold text **bold text** | ||||
571 | | ||||
572 | <!-- A delimiter is required after or before _ --> | ||||
573 | aaa**bold text**aaaaa | ||||
574 | aaa__normal text__aaaaa | ||||
575 | пристаням_стремятся_ | ||||
576 | | ||||
577 | <!-- Escapes within bold or italic text --> | ||||
578 | \*normal text* | ||||
579 | _normal text\_ | ||||
580 | **italic text\** | ||||
581 | ***only bold\*** | ||||
582 | **bold\** bold** |