Commit 656d9548bcfa315751fc01b3afb0ec14104e15a8

Authored by Marin Jankovski
1 parent 3f818a3d

Update markdown documentation, fix wiki spec.

doc/markdown/markdown.md
... ... @@ -8,23 +8,38 @@ Table of Contents
8 8 **[GitLab Flavored Markdown](#gitlab-flavored-markdown-gfm)**
9 9  
10 10 [Newlines](#newlines)
  11 +
11 12 [Multiple underscores in words](#multiple-underscores-in-words)
  13 +
12 14 [URL autolinking](#url-autolinking)
  15 +
13 16 [Code and Syntax Highlighting](#code-and-syntax-highlighting)
  17 +
14 18 [Emoji](#emoji)
  19 +
15 20 [Special GitLab references](#special-gitlab-references)
16 21  
  22 +
17 23 **[Standard Markdown](#standard-markdown)**
18 24  
19 25 [Headers](#headers)
  26 +
20 27 [Emphasis](#emphasis)
  28 +
21 29 [Lists](#lists)
  30 +
22 31 [Links](#links)
  32 +
23 33 [Images](#images)
  34 +
24 35 [Blockquotes](#blockquotes)
  36 +
25 37 [Inline HTML](#inline-html)
  38 +
26 39 [Horizontal Rule](#horizontal-rule)
  40 +
27 41 [Line Breaks](#line-breaks)
  42 +
28 43 [Tables](#tables)
29 44  
30 45 **[References](#references)**
... ... @@ -33,7 +48,8 @@ Table of Contents
33 48  
34 49 GitLab Flavored Markdown (GFM)
35 50 ==============================
36   -For GitLab we developed something we call "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few significant ways to add some useful functionality.
  51 +For GitLab we developed something we call "GitLab Flavored Markdown" (GFM).
  52 +It extends the standard Markdown in a few significant ways to add some useful functionality.
37 53  
38 54 You can use GFM in
39 55  
... ... @@ -51,16 +67,20 @@ Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#mar
51 67  
52 68 Newlines
53 69 --------
54   -The biggest difference that GFM introduces is in the handling of linebreaks. With traditional Markdown you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors. GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended.
  70 +GFM honors the markdown specification in how [paragraphs and line breaks are handled](http://daringfireball.net/projects/markdown/syntax#p).
55 71  
56   -The next paragraph contains two phrases separated by a single newline character:
  72 +A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines.:
57 73  
58 74 Roses are red
59 75 Violets are blue
60 76  
  77 + Sugar is sweet
  78 +
61 79 Roses are red
62 80 Violets are blue
63 81  
  82 +Sugar is sweet
  83 +
64 84 Multiple underscores in words
65 85 -----------------------------
66 86 It is not reasonable to italicize just _part_ of a word, especially when you're dealing with code and names that often appear with multiple underscores. Therefore, GFM ignores multiple underscores in words.
... ... @@ -319,13 +339,13 @@ Strikethrough uses two tildes. ~~Scratch this.~~
319 339  
320 340 ## Links
321 341  
322   -There are two ways to create links.
  342 +There are two ways to create links, inline-style and reference-style.
323 343  
324 344 [I'm an inline-style link](https://www.google.com)
325 345  
326 346 [I'm a reference-style link][Arbitrary case-insensitive reference text]
327 347  
328   - [I'm a relative reference to a repository file](../blob/master/LICENSE)
  348 + [I'm a relative reference to a repository file](LICENSE)
329 349  
330 350 [You can use numbers for reference-style link definitions][1]
331 351  
... ... @@ -341,7 +361,7 @@ There are two ways to create links.
341 361  
342 362 [I'm a reference-style link][Arbitrary case-insensitive reference text]
343 363  
344   -[I'm a relative reference to a repository file](../blob/master/LICENSE)
  364 +[I'm a relative reference to a repository file](LICENSE)
345 365  
346 366 [You can use numbers for reference-style link definitions][1]
347 367  
... ... @@ -353,6 +373,15 @@ Some text to show that the reference links can follow later.
353 373 [1]: http://slashdot.org
354 374 [link text itself]: http://www.reddit.com
355 375  
  376 +**Note**
  377 +
  378 +Relative links do not allow referencing project files in a wiki page or wiki page in a project file.
  379 +The reason for this is that, in GitLab, wiki is always a separate git repository. For example:
  380 +
  381 +`[I'm a reference-style link][style]`
  382 +
  383 +will point the link to `wikis/style` when the link is inside of a wiki markdown file.
  384 +
356 385 ## Images
357 386  
358 387 Here's our logo (hover to see the title text):
... ... @@ -365,15 +394,15 @@ Some text to show that the reference links can follow later.
365 394  
366 395 [logo]: assets/logo-white.png
367 396  
368   -Here's our logo (hover to see the title text):
  397 +Here's our logo:
369 398  
370 399 Inline-style:
371   -![alt text](/assets/logo-white.png "Logo Title Text 1")
  400 +![alt text](/assets/logo-white.png)
372 401  
373 402 Reference-style:
374 403 ![alt text][logo]
375 404  
376   -[logo]: /assets/logo-white.png "Logo Title Text 2"
  405 +[logo]: /assets/logo-white.png
377 406  
378 407 ## Blockquotes
379 408  
... ...
spec/helpers/gitlab_markdown_helper_spec.rb
... ... @@ -440,12 +440,6 @@ describe GitlabMarkdownHelper do
440 440 markdown(actual).should match(expected)
441 441 end
442 442  
443   - it "should handle wiki urls" do
444   - actual = "[Link](test/link)\n"
445   - expected = "<p><a href=\"/#{project.path_with_namespace}/wikis/test/link\">Link</a></p>\n"
446   - markdown(actual).should match(expected)
447   - end
448   -
449 443 it "should handle relative urls in reference links for a file in master" do
450 444 actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n"
451 445 expected = "<p><a href=\"/#{project.path_with_namespace}/blob/master/doc/api/README.md\">GitLab API doc</a></p>\n"
... ...