| 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 |
|
| 9 |
# H1 |
| 10 |
|
| 11 |
## H2 |
| 12 |
|
| 13 |
### H3 |
| 14 |
|
| 15 |
Multi-line paragraph bla bla bla |
| 16 |
bla bla bla. |
| 17 |
|
| 18 |
Intentional line break |
| 19 |
via two spaces at line. |
| 20 |
|
| 21 |
Formats: _italic_, **bold**, `monospace`, ~~strikeout~~ |
| 22 |
|
| 23 |
Bullet list: |
| 24 |
|
| 25 |
* item1 |
| 26 |
* item2 |
| 27 |
|
| 28 |
Numbered list: |
| 29 |
|
| 30 |
1. item 1 |
| 31 |
2. item 2 |
| 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 |
|
| 41 |
[link](http://kde.org) |
| 42 |
|
| 43 |
Auto-link: <http://kate-editor.org> |
| 44 |
Mail: <mailto:[email protected]> |
| 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 |
 |
| 58 |
|
| 59 |
 |
| 60 |
|
| 61 |
[](https://link.com/example/) |
| 62 |
|
| 63 |
code 1 |
| 64 |
code 2 |
| 65 |
|
| 66 |
normal text |
| 67 |
|
| 68 |
> block quote _italic_ |
| 69 |
> more block quote |
| 70 |
|
| 71 |
normal text |
| 72 |
|
| 73 |
Title: some text |
| 74 |
|
| 75 |
normal text |
| 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 |
|
| 189 |
# Fenced code blocks (bug 356974) |
| 190 |
|
| 191 |
## Bash |
| 192 |
|
| 193 |
```bash |
| 194 |
#!/usr/bin/env bash |
| 195 |
|
| 196 |
for f in *; do |
| 197 |
echo "$f" |
| 198 |
done |
| 199 |
``` |
| 200 |
|
| 201 |
## C++ |
| 202 |
|
| 203 |
```cpp |
| 204 |
#include <QtCore/QObject> |
| 205 |
|
| 206 |
class Q : public QObject { |
| 207 |
Q_OBJECT |
| 208 |
public: |
| 209 |
Q(); |
| 210 |
} |
| 211 |
|
| 212 |
Q::Q() :QObject(NULL) { |
| 213 |
} |
| 214 |
``` |
| 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 |
|
| 234 |
## CMake |
| 235 |
|
| 236 |
```cmake |
| 237 |
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) |
| 238 |
|
| 239 |
project (hello_world) |
| 240 |
|
| 241 |
set(QT_MIN_VERSION "5.6.0") |
| 242 |
``` |
| 243 |
|
| 244 |
## CSS |
| 245 |
|
| 246 |
```css |
| 247 |
h1.main::hover { |
| 248 |
font-size: 100; |
| 249 |
color: green; |
| 250 |
} |
| 251 |
``` |
| 252 |
|
| 253 |
## Email |
| 254 |
|
| 255 |
```email |
| 256 |
From: Konqi Dragon <[email protected]> |
| 257 |
To: All <[email protected]> |
| 258 |
Subject: highlights |
| 259 |
``` |
| 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 |
|
| 273 |
## Haskell |
| 274 |
|
| 275 |
```haskell |
| 276 |
module Main (main) where |
| 277 |
|
| 278 |
main :: IO () |
| 279 |
main = putStrLn "Hello, World!" |
| 280 |
``` |
| 281 |
|
| 282 |
## HTML |
| 283 |
|
| 284 |
```html |
| 285 |
<html> |
| 286 |
<body> |
| 287 |
<p class="main">Hello world!</p> |
| 288 |
</body> |
| 289 |
</html> |
| 290 |
``` |
| 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 |
|
| 334 |
## JSON |
| 335 |
|
| 336 |
```json |
| 337 |
[{ |
| 338 |
"hello": "world", |
| 339 |
"count": 1, |
| 340 |
"bool": true |
| 341 |
}] |
| 342 |
``` |
| 343 |
|
| 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; |
| 378 |
|
| 379 |
$var =~ s/bla/foo/igs; |
| 380 |
$var =~ s!bla!foo!igs; |
| 381 |
$var =~ s#bla#foo#igs; |
| 382 |
``` |
| 383 |
|
| 384 |
## PHP |
| 385 |
|
| 386 |
```php |
| 387 |
namespace Application\Controller; |
| 388 |
|
| 389 |
use Zend\Mvc\Controller\AbstractActionController; |
| 390 |
|
| 391 |
class IndexController extends AbstractActionController |
| 392 |
{ |
| 393 |
} |
| 394 |
``` |
| 395 |
|
| 396 |
## Python |
| 397 |
|
| 398 |
```python |
| 399 |
def addXToY(x, y): |
| 400 |
total = x + y |
| 401 |
print total |
| 402 |
``` |
| 403 |
|
| 404 |
## QML |
| 405 |
|
| 406 |
```qml |
| 407 |
Text { |
| 408 |
id: hello |
| 409 |
width: 100 |
| 410 |
text: "Hello world!" |
| 411 |
} |
| 412 |
``` |
| 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 |
## Raku |
| 426 |
|
| 427 |
```raku |
| 428 |
grammar Parser { |
| 429 |
rule TOP { I <love> <lang> } |
| 430 |
token love { '♥' | love } |
| 431 |
token lang { < Raku Perl Rust Go Python Ruby > } |
| 432 |
} |
| 433 |
|
| 434 |
say Parser.parse: 'I ♥ Raku'; |
| 435 |
|
| 436 |
say 1 #`««« blah TODO blah |
| 437 |
here? »»» 2 ; |
| 438 |
say 1 #` ( blah TODO blah |
| 439 |
2 ; |
| 440 |
rx- regex - |
| 441 |
``` |
| 442 |
|
| 443 |
## Ruby |
| 444 |
|
| 445 |
```ruby |
| 446 |
require 'Config' |
| 447 |
def CGI::escape(string) |
| 448 |
string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do |
| 449 |
'%' + $1.unpack('H2' * $1.size).join('%').upcase |
| 450 |
end.tr(' ', '+') |
| 451 |
end |
| 452 |
``` |
| 453 |
|
| 454 |
## Rust |
| 455 |
|
| 456 |
```rust |
| 457 |
fn main() { |
| 458 |
println!("Hello world!"); |
| 459 |
} |
| 460 |
``` |
| 461 |
|
| 462 |
## MySQL |
| 463 |
|
| 464 |
```mysql |
| 465 |
-- comment |
| 466 |
CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar); |
| 467 |
SELECT * FROM stuff WHERE id = 'string'; |
| 468 |
select * from stuff where id < 0.42; |
| 469 |
Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL; |
| 470 |
``` |
| 471 |
|
| 472 |
## Nim |
| 473 |
|
| 474 |
```nim |
| 475 |
proc main() = |
| 476 |
echo "Hello world!" |
| 477 |
``` |
| 478 |
|
| 479 |
## TypeScript |
| 480 |
|
| 481 |
```ts |
| 482 |
class Student { |
| 483 |
fullName: string; |
| 484 |
constructor(public firstName: string, public middleInitial: string, public lastName: string) { |
| 485 |
this.fullName = firstName + " " + middleInitial + " " + lastName; |
| 486 |
} |
| 487 |
} |
| 488 |
``` |
| 489 |
|
| 490 |
## XML |
| 491 |
|
| 492 |
```xml |
| 493 |
<tag attribute="3"> |
| 494 |
<nested/> |
| 495 |
</tag> |
| 496 |
``` |
| 497 |
|
| 498 |
## reStructuredText |
| 499 |
|
| 500 |
```rst |
| 501 |
Section Header |
| 502 |
============== |
| 503 |
|
| 504 |
.. image:: /path/to/image.jpg |
| 505 |
|
| 506 |
- A bullet list item |
| 507 |
``` |
| 508 |
|
| 509 |
## Doxygen |
| 510 |
|
| 511 |
```doxygen |
| 512 |
a normal member taking two arguments and returning an integer value. |
| 513 |
@param a an integer argument. |
| 514 |
@param s a constant character pointer. |
| 515 |
@see Javadoc_Test() |
| 516 |
@see publicVar() |
| 517 |
@return The test results |
| 518 |
``` |
| 519 |
|
| 520 |
## No language specified |
| 521 |
|
| 522 |
``` |
| 523 |
No language is specified, but it should be still rendered as code block. |
| 524 |
``` |
| 525 |
|
| 526 |
# Fenced code blocks with more than 3 backticks or tildes |
| 527 |
|
| 528 |
~~~ |
| 529 |
Fenced code block with 3 tildes. |
| 530 |
~~~ |
| 531 |
|
| 532 |
````````` |
| 533 |
Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes. |
| 534 |
``` |
| 535 |
The block ends with the same amount of backticks. |
| 536 |
````````` |
| 537 |
|
| 538 |
~~~~~~~~~~~~ |
| 539 |
Fenced code block with more tildes. |
| 540 |
~~~~~~~~~~~~ |
| 541 |
|
| 542 |
## With languages |
| 543 |
|
| 544 |
```````html |
| 545 |
<html> |
| 546 |
<body> |
| 547 |
<p class="main">Hello world!</p> |
| 548 |
</body> |
| 549 |
</html> |
| 550 |
``` <!-- <= doesn't end here --> |
| 551 |
``````` |
| 552 |
|
| 553 |
~~~bash |
| 554 |
for f in *; do |
| 555 |
echo "$f" |
| 556 |
done |
| 557 |
~~~ |
| 558 |
|
| 559 |
~~~~~~~~~python |
| 560 |
def addXToY(x, y): |
| 561 |
total = x + y |
| 562 |
print total |
| 563 |
~~~ # <= doesn't end here |
| 564 |
~~~~~~~~~ |
| 565 |
|
| 566 |
# Italic and bold text |
| 567 |
|
| 568 |
**b** *i* __b__ _i_ |
| 569 |
***ib*** ___ib___ |
| 570 |
**_ib_** __*ib*__ |
| 571 |
|
| 572 |
* _italic_ **bold** ***ib*** ~~strikeout~~ |
| 573 |
|
| 574 |
> _italic_ **bold** ***ib*** ~~strikeout~~ |
| 575 |
|
| 576 |
## Bold |
| 577 |
**bold*___text** normal |
| 578 |
__bold_***text__ normal |
| 579 |
|
| 580 |
## Italic |
| 581 |
*italic _ text* normal |
| 582 |
_italic * text_ normal |
| 583 |
|
| 584 |
## Italic-Bold |
| 585 |
***italic-bold ** italic-bold*** normal |
| 586 |
***bold-italic text **bold-italic text*** normal |
| 587 |
***bold*italic*** normal |
| 588 |
**_bold-italic text_** normal |
| 589 |
|
| 590 |
<!-- A non-space character is required after or before * or _ --> |
| 591 |
_ normal text_ * normal text * |
| 592 |
*italic text*normal text* |
| 593 |
*italic text *italic text* |
| 594 |
**bold text**normal text** |
| 595 |
**bold text **bold text** |
| 596 |
|
| 597 |
<!-- A delimiter is required after or before _ --> |
| 598 |
aaa**bold text**aaaaa |
| 599 |
aaa__normal text__aaaaa |
| 600 |
пристаням_стремятся_ |
| 601 |
|
| 602 |
<!-- Escapes within bold or italic text --> |
| 603 |
\*normal text* |
| 604 |
_normal text\_ |
| 605 |
**italic text\** |
| 606 |
***only bold\*** |
| 607 |
**bold\** bold** |
| 608 |
|
| 609 |
<!-- Folding regions for nested headers should also be closed when the parent header is closed --> |
| 610 |
# 1 |
| 611 |
## 2 |
| 612 |
### 3 |
| 613 |
#### 4 |
| 614 |
##### 5 |
| 615 |
###### 6 |
| 616 |
# 11; 1-6 should close here |
| 617 |
## 22 |
| 618 |
### 33 |
| 619 |
## 222; 22 and 33 should close here |