Commit 0093554a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add test and docs for markdown tables

parent 3cc26654
...@@ -27,8 +27,9 @@ Table of Contents ...@@ -27,8 +27,9 @@ Table of Contents
[Inline HTML](#toc_25) [Inline HTML](#toc_25)
[Horizontal Rule](#toc_26) [Horizontal Rule](#toc_26)
[Line Breaks](#toc_27) [Line Breaks](#toc_27)
[Tables](#toc_28)
[References](#toc_28) [References](#toc_29)
--------------------- ---------------------
---------------------------------------------- ----------------------------------------------
...@@ -440,6 +441,26 @@ This line is separated from the one above by two newlines, so it will be a *sepa ...@@ -440,6 +441,26 @@ This line is separated from the one above by two newlines, so it will be a *sepa
This line is also begins a separate paragraph, but... This line is also begins a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*. This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
## Tables
Tables aren't part of the core Markdown spec, but they are part of GFM and Markdown Here supports them.
```
| header 1 | header 2 |
| -------- | -------- |
| cell 1 | cell 2 |
| cell 3 | cell 4 |
```
Code above produces next output:
| header 1 | header 2 |
| -------- | -------- |
| cell 1 | cell 2 |
| cell 3 | cell 4 |
------------ ------------
<a name="references"/> <a name="references"/>
......
...@@ -366,6 +366,15 @@ describe GitlabMarkdownHelper do ...@@ -366,6 +366,15 @@ describe GitlabMarkdownHelper do
markdown(actual).should match(%r{Apply <em><a.+>!#{merge_request.iid}</a></em>}) markdown(actual).should match(%r{Apply <em><a.+>!#{merge_request.iid}</a></em>})
end end
it "should handle tables" do
actual = %Q{| header 1 | header 2 |
| -------- | -------- |
| cell 1 | cell 2 |
| cell 3 | cell 4 |}
markdown(actual).should match(/\A<table/)
end
it "should leave code blocks untouched" do it "should leave code blocks untouched" do
helper.stub(:user_color_scheme_class).and_return(:white) helper.stub(:user_color_scheme_class).and_return(:white)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment