markdown-testsuite 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/CONTRIBUTING.md +109 -0
- data/Gemfile +3 -0
- data/LICENSE.md +11 -0
- data/README.md +40 -0
- data/Rakefile +9 -0
- data/lib/markdown-testsuite.rb +71 -0
- data/lib/markdown/testsuite/test.rb +20 -0
- data/lib/markdown/testsuite/version.rb +8 -0
- data/markdown-spec.html +315 -0
- data/markdown-testsuite.gemspec +23 -0
- data/specification/2-paragraphs-hard-return-spaces.md +5 -0
- data/specification/2-paragraphs-hard-return-spaces.out +5 -0
- data/specification/2-paragraphs-hard-return.md +5 -0
- data/specification/2-paragraphs-hard-return.out +5 -0
- data/specification/2-paragraphs-line-returns.md +5 -0
- data/specification/2-paragraphs-line-returns.out +3 -0
- data/specification/2-paragraphs-line-spaces.md +3 -0
- data/specification/2-paragraphs-line-spaces.out +3 -0
- data/specification/2-paragraphs-line-tab.md +3 -0
- data/specification/2-paragraphs-line-tab.out +3 -0
- data/specification/2-paragraphs-line.md +3 -0
- data/specification/2-paragraphs-line.out +3 -0
- data/specification/EOL-CR+LF.md +6 -0
- data/specification/EOL-CR+LF.out +5 -0
- data/specification/EOL-CR.md +1 -0
- data/specification/EOL-CR.out +1 -0
- data/specification/EOL-LF.md +6 -0
- data/specification/EOL-LF.out +5 -0
- data/specification/ampersand-text-flow.md +1 -0
- data/specification/ampersand-text-flow.out +1 -0
- data/specification/ampersand-uri.md +1 -0
- data/specification/ampersand-uri.out +1 -0
- data/specification/asterisk-near-text.md +1 -0
- data/specification/asterisk-near-text.out +1 -0
- data/specification/asterisk.md +1 -0
- data/specification/asterisk.out +1 -0
- data/specification/backslash-escape.md +12 -0
- data/specification/backslash-escape.out +12 -0
- data/specification/blockquote-added-markup.md +3 -0
- data/specification/blockquote-added-markup.out +5 -0
- data/specification/blockquote-line-2-paragraphs.md +3 -0
- data/specification/blockquote-line-2-paragraphs.out +5 -0
- data/specification/blockquote-line.md +1 -0
- data/specification/blockquote-line.out +3 -0
- data/specification/blockquote-multiline-1-space-begin.md +3 -0
- data/specification/blockquote-multiline-1-space-begin.out +5 -0
- data/specification/blockquote-multiline-1-space-end.md +3 -0
- data/specification/blockquote-multiline-1-space-end.out +5 -0
- data/specification/blockquote-multiline-2-paragraphs.md +6 -0
- data/specification/blockquote-multiline-2-paragraphs.out +8 -0
- data/specification/blockquote-multiline.md +3 -0
- data/specification/blockquote-multiline.out +5 -0
- data/specification/blockquote-nested-multiplereturn-level1.md +5 -0
- data/specification/blockquote-nested-multiplereturn-level1.out +9 -0
- data/specification/blockquote-nested-multiplereturn.md +3 -0
- data/specification/blockquote-nested-multiplereturn.out +7 -0
- data/specification/blockquote-nested-return-level1.md +3 -0
- data/specification/blockquote-nested-return-level1.out +8 -0
- data/specification/blockquote-nested.md +2 -0
- data/specification/blockquote-nested.out +7 -0
- data/specification/code-1-tab.md +2 -0
- data/specification/code-1-tab.out +3 -0
- data/specification/code-4-spaces-escaping.md +2 -0
- data/specification/code-4-spaces-escaping.out +3 -0
- data/specification/code-4-spaces.md +2 -0
- data/specification/code-4-spaces.out +3 -0
- data/specification/em-middle-word.md +1 -0
- data/specification/em-middle-word.out +1 -0
- data/specification/em-star.md +1 -0
- data/specification/em-star.out +1 -0
- data/specification/em-underscore.md +1 -0
- data/specification/em-underscore.out +1 -0
- data/specification/entities-text-flow.md +1 -0
- data/specification/entities-text-flow.out +1 -0
- data/specification/extensions/fenced-code-block-p.out +3 -0
- data/specification/extensions/fenced-code-block-pre.out +3 -0
- data/specification/extensions/fenced-code-block.md +3 -0
- data/specification/extensions/gfm/README.markdown +1 -0
- data/specification/extensions/gfm/fenced-code-block.md +0 -0
- data/specification/extensions/gfm/fenced-code-block.out +3 -0
- data/specification/extensions/gfm/utf8.md +1 -0
- data/specification/extensions/gfm/utf8.out +1 -0
- data/specification/extensions/kramdown/README.markdown +1 -0
- data/specification/extensions/kramdown/fenced-code-block.md +0 -0
- data/specification/extensions/kramdown/fenced-code-block.out +3 -0
- data/specification/extensions/kramdown/utf8.md +1 -0
- data/specification/extensions/kramdown/utf8.out +1 -0
- data/specification/extensions/multimarkdown/README.markdown +1 -0
- data/specification/extensions/multimarkdown/fenced-code-block.md +0 -0
- data/specification/extensions/multimarkdown/fenced-code-block.out +3 -0
- data/specification/extensions/multimarkdown/utf8.md +1 -0
- data/specification/extensions/multimarkdown/utf8.out +1 -0
- data/specification/extensions/pandoc/README.markdown +1 -0
- data/specification/extensions/pandoc/fenced-code-block.md +0 -0
- data/specification/extensions/pandoc/fenced-code-block.out +3 -0
- data/specification/extensions/pandoc/utf8.md +1 -0
- data/specification/extensions/pandoc/utf8.out +1 -0
- data/specification/extensions/redcarpet/README.markdown +1 -0
- data/specification/extensions/redcarpet/fenced-code-block.md +0 -0
- data/specification/extensions/redcarpet/fenced-code-block.out +3 -0
- data/specification/extensions/redcarpet/utf8.md +1 -0
- data/specification/extensions/redcarpet/utf8.out +1 -0
- data/specification/extensions/utf8.md +1 -0
- data/specification/extensions/utf8.out +1 -0
- data/specification/header-level1-equal-underlined.md +2 -0
- data/specification/header-level1-equal-underlined.out +1 -0
- data/specification/header-level1-hash-sign-closed.md +1 -0
- data/specification/header-level1-hash-sign-closed.out +1 -0
- data/specification/header-level1-hash-sign-trailing-1-space.md +1 -0
- data/specification/header-level1-hash-sign-trailing-1-space.out +1 -0
- data/specification/header-level1-hash-sign-trailing-2-spaces.md +2 -0
- data/specification/header-level1-hash-sign-trailing-2-spaces.out +3 -0
- data/specification/header-level1-hash-sign.md +1 -0
- data/specification/header-level1-hash-sign.out +1 -0
- data/specification/header-level2-dash-underlined.md +2 -0
- data/specification/header-level2-dash-underlined.out +1 -0
- data/specification/header-level2-hash-sign-closed.md +1 -0
- data/specification/header-level2-hash-sign-closed.out +1 -0
- data/specification/header-level2-hash-sign.md +1 -0
- data/specification/header-level2-hash-sign.out +1 -0
- data/specification/header-level3-hash-sign-closed.md +1 -0
- data/specification/header-level3-hash-sign-closed.out +1 -0
- data/specification/header-level3-hash-sign.md +1 -0
- data/specification/header-level3-hash-sign.out +1 -0
- data/specification/header-level4-hash-sign-closed.md +1 -0
- data/specification/header-level4-hash-sign-closed.out +1 -0
- data/specification/header-level4-hash-sign.md +1 -0
- data/specification/header-level4-hash-sign.out +1 -0
- data/specification/header-level5-hash-sign-closed.md +1 -0
- data/specification/header-level5-hash-sign-closed.out +1 -0
- data/specification/header-level5-hash-sign.md +1 -0
- data/specification/header-level5-hash-sign.out +1 -0
- data/specification/header-level6-hash-sign-closed.md +1 -0
- data/specification/header-level6-hash-sign-closed.out +1 -0
- data/specification/header-level6-hash-sign.md +1 -0
- data/specification/header-level6-hash-sign.out +1 -0
- data/specification/horizontal-rule-3-dashes-spaces.md +1 -0
- data/specification/horizontal-rule-3-dashes-spaces.out +1 -0
- data/specification/horizontal-rule-3-dashes.md +1 -0
- data/specification/horizontal-rule-3-dashes.out +1 -0
- data/specification/horizontal-rule-3-stars.md +1 -0
- data/specification/horizontal-rule-3-stars.out +1 -0
- data/specification/horizontal-rule-3-underscores.md +1 -0
- data/specification/horizontal-rule-3-underscores.out +1 -0
- data/specification/horizontal-rule-7-dashes.md +1 -0
- data/specification/horizontal-rule-7-dashes.out +1 -0
- data/specification/img-idref-title.md +3 -0
- data/specification/img-idref-title.out +1 -0
- data/specification/img-idref.md +3 -0
- data/specification/img-idref.out +1 -0
- data/specification/img-title.md +1 -0
- data/specification/img-title.out +1 -0
- data/specification/img.md +1 -0
- data/specification/img.out +1 -0
- data/specification/inline-code-escaping-entities.md +1 -0
- data/specification/inline-code-escaping-entities.out +1 -0
- data/specification/inline-code-with-visible-backtick.md +1 -0
- data/specification/inline-code-with-visible-backtick.out +1 -0
- data/specification/inline-code.md +1 -0
- data/specification/inline-code.out +1 -0
- data/specification/line-break-2-spaces.md +2 -0
- data/specification/line-break-2-spaces.out +2 -0
- data/specification/line-break-5-spaces.md +2 -0
- data/specification/line-break-5-spaces.out +2 -0
- data/specification/link-automatic-email.md +1 -0
- data/specification/link-automatic-email.out +1 -0
- data/specification/link-automatic.md +1 -0
- data/specification/link-automatic.out +1 -0
- data/specification/link-bracket-paranthesis-title.md +1 -0
- data/specification/link-bracket-paranthesis-title.out +1 -0
- data/specification/link-bracket-paranthesis.md +1 -0
- data/specification/link-bracket-paranthesis.out +1 -0
- data/specification/link-idref-angle-bracket.md +3 -0
- data/specification/link-idref-angle-bracket.out +1 -0
- data/specification/link-idref-implicit-spaces.md +3 -0
- data/specification/link-idref-implicit-spaces.out +1 -0
- data/specification/link-idref-implicit.md +3 -0
- data/specification/link-idref-implicit.out +1 -0
- data/specification/link-idref-space.md +3 -0
- data/specification/link-idref-space.out +1 -0
- data/specification/link-idref-title-next-line.md +4 -0
- data/specification/link-idref-title-next-line.out +1 -0
- data/specification/link-idref-title-paranthesis.md +3 -0
- data/specification/link-idref-title-paranthesis.out +1 -0
- data/specification/link-idref-title-single-quote.md +3 -0
- data/specification/link-idref-title-single-quote.out +1 -0
- data/specification/link-idref-title.md +3 -0
- data/specification/link-idref-title.out +1 -0
- data/specification/link-idref.md +3 -0
- data/specification/link-idref.out +1 -0
- data/specification/list-blockquote.md +3 -0
- data/specification/list-blockquote.out +7 -0
- data/specification/list-code.md +4 -0
- data/specification/list-code.out +7 -0
- data/specification/list-multiparagraphs-tab.md +9 -0
- data/specification/list-multiparagraphs-tab.out +10 -0
- data/specification/list-multiparagraphs.md +9 -0
- data/specification/list-multiparagraphs.out +10 -0
- data/specification/ordered-list-escaped.md +1 -0
- data/specification/ordered-list-escaped.out +1 -0
- data/specification/ordered-list-items-random-number.md +3 -0
- data/specification/ordered-list-items-random-number.out +5 -0
- data/specification/ordered-list-items.md +3 -0
- data/specification/ordered-list-items.out +5 -0
- data/specification/paragraph-hard-return.md +3 -0
- data/specification/paragraph-hard-return.out +3 -0
- data/specification/paragraph-line.md +1 -0
- data/specification/paragraph-line.out +1 -0
- data/specification/paragraph-trailing-leading-spaces.md +1 -0
- data/specification/paragraph-trailing-leading-spaces.out +1 -0
- data/specification/paragraph-trailing-tab.md +1 -0
- data/specification/paragraph-trailing-tab.out +1 -0
- data/specification/paragraphs-2-leading-spaces.md +1 -0
- data/specification/paragraphs-2-leading-spaces.out +1 -0
- data/specification/paragraphs-3-leading-spaces.md +1 -0
- data/specification/paragraphs-3-leading-spaces.out +1 -0
- data/specification/paragraphs-leading-space.md +1 -0
- data/specification/paragraphs-leading-space.out +1 -0
- data/specification/paragraphs-trailing-spaces.md +1 -0
- data/specification/paragraphs-trailing-spaces.out +1 -0
- data/specification/strong-middle-word.md +1 -0
- data/specification/strong-middle-word.out +1 -0
- data/specification/strong-star.md +1 -0
- data/specification/strong-star.out +1 -0
- data/specification/strong-underscore.md +1 -0
- data/specification/strong-underscore.out +1 -0
- data/specification/unordered-list-items-asterisk.md +3 -0
- data/specification/unordered-list-items-asterisk.out +5 -0
- data/specification/unordered-list-items-dashsign.md +3 -0
- data/specification/unordered-list-items-dashsign.out +5 -0
- data/specification/unordered-list-items-leading-1space.md +3 -0
- data/specification/unordered-list-items-leading-1space.out +5 -0
- data/specification/unordered-list-items-leading-2spaces.md +3 -0
- data/specification/unordered-list-items-leading-2spaces.out +5 -0
- data/specification/unordered-list-items-leading-3spaces.md +3 -0
- data/specification/unordered-list-items-leading-3spaces.out +5 -0
- data/specification/unordered-list-items-plussign.md +3 -0
- data/specification/unordered-list-items-plussign.out +5 -0
- data/specification/unordered-list-paragraphs.md +3 -0
- data/specification/unordered-list-paragraphs.out +4 -0
- data/specification/unordered-list-unindented-content.md +2 -0
- data/specification/unordered-list-unindented-content.out +4 -0
- data/specification/unordered-list-with-indented-content.md +5 -0
- data/specification/unordered-list-with-indented-content.out +7 -0
- data/specs/spec_helper.rb +2 -0
- data/specs/testsuite_spec.rb +41 -0
- metadata +321 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5dc4fc26b551a7b9560f234de9723a4cb23fd5ed
|
4
|
+
data.tar.gz: 0c3a3a35c2cc2fbfdfd6347d8ed90859acb18ac4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c635efec1abb68ef0fad377b485f3511015558b91e7fa1a9ca7cea6ea5b589e47d6c7c929521bde6877b80f9bfa61af1cd5e037dfb1d325eb86fe7f44f14478
|
7
|
+
data.tar.gz: 84eb02f2dab6386efacc8965cc89bad0e229742cb3621e56df2febe0559c0cf8309f46b4b11641405aa6f6c786ecf89b1ae608ec0d3f5d944beef5c190850551
|
data/.gitignore
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Contributing to Mardown Test Suite
|
2
|
+
|
3
|
+
1. [Getting Involved](#getting-involved)
|
4
|
+
2. [Discussion](#discussion)
|
5
|
+
3. [How To Report an Issue](#how-to-report-an-issue)
|
6
|
+
4. [Editing Markdown Specification](#editing-markdown-specification)
|
7
|
+
5. [Test Suite Guidelines](#test-suite-guidelines)
|
8
|
+
6. [Pull Request Guidelines](#pull-request-guidelines)
|
9
|
+
|
10
|
+
## Getting Involved
|
11
|
+
|
12
|
+
There are a number of ways to get involved with the development of the Markdown Test Suite. If you are a first time contributor to an open source project, you can still add value to this project. You may identify grammar issues, write prose, examples or documentation for the project. You may flag some errors and open new issues.
|
13
|
+
|
14
|
+
Read all bits of this document and that will guide you on how to participate.
|
15
|
+
|
16
|
+
## Discussion
|
17
|
+
|
18
|
+
### Mailing List
|
19
|
+
|
20
|
+
The Markdown Test Suite has been started a little bit after the start of the [Markdown Community Group](http://www.w3.org/community/markdown/). You may want to discuss about Markdown and this project on the [group mailing-list](http://lists.w3.org/Archives/Public/public-markdown/).
|
21
|
+
|
22
|
+
## How to Report an Issue
|
23
|
+
|
24
|
+
Don't be afraid to add details to your issue. The more context you give, the better for people participating to the project. Make a short summary, add a description with the context and give links to places which will help to understand.
|
25
|
+
|
26
|
+
## Editing Markdown Specification
|
27
|
+
|
28
|
+
There is much needed work on the [Markdown Specification](http://htmlpreview.github.io/?https://github.com/karlcow/markdown-testsuite/blob/master/markdown-spec.html). It doesn't require strong competences in coding. Be systematic in the markup and follow the way it is already organized. Each time you added a new atomic section, create a commit for this specific part.
|
29
|
+
|
30
|
+
## Test Suite Guidelines
|
31
|
+
|
32
|
+
When proposing new tests, make sure they do not already exist in the current test suite. You will notice that there is a separate section dedicated to the specific extensions that some markdown generators have created. Keep them separate. We want to keep the core clean and close to the original specification of Markdown.
|
33
|
+
|
34
|
+
If you are not sure, create an issue.
|
35
|
+
|
36
|
+
### Markdown Extensions
|
37
|
+
|
38
|
+
Markdown extension tests are accepted. Use the following rules:
|
39
|
+
|
40
|
+
- place all extension tests under the `test/extensions/ENGINE` directory with filename equal to the feature name
|
41
|
+
- for each `ENGINE` and add a `README.markdown` under the engine directory with a link to its specification
|
42
|
+
|
43
|
+
where `ENGINE` is either of:
|
44
|
+
|
45
|
+
- a command line utility. E.g. `pandoc`, `kramdown`.
|
46
|
+
- a programming API. E.g. `Redcarpet::Markdown.new()`.
|
47
|
+
- a programmatically accessible web service. E.g.: GFM via the GitHub API.
|
48
|
+
- a non programmatically accessible web service. E.g.: Stack Overflow flavored markdown.
|
49
|
+
|
50
|
+
To avoid test duplication for common features, use the following rules:
|
51
|
+
|
52
|
+
- if file `tests/extensions/ENGINE/FEATURE.md` is empty or not present, use `tests/extensions/FEATURE.md` instead
|
53
|
+
- if file `tests/extensions/ENGINE/FEATURE.out` not present, use `tests/extensions/FEATURE.out` instead
|
54
|
+
- for a given `ENGINE`, only features which have either a `.md` or a `.out` are implemented by that engine.
|
55
|
+
- in case of different outputs for a single feature input, keep directly under `extensions/` only the output case that happens across the most engines
|
56
|
+
|
57
|
+
**version**
|
58
|
+
|
59
|
+
Only the latest stable version of each `ENGINE` is considered.
|
60
|
+
|
61
|
+
**options**
|
62
|
+
|
63
|
+
The IO behavior tested is for engine defaults, without any options (command line options, extra JSON parameters, etc.) passed to the engine.
|
64
|
+
|
65
|
+
**external state**
|
66
|
+
|
67
|
+
Tests that use external state not present in the markdown input shall not be included in this test suite.
|
68
|
+
|
69
|
+
For example, what GFM `@user` user tags render to also depends on the state of GitHub's databases (only render to a link if user exists), not only on the input markdown.
|
70
|
+
|
71
|
+
#### Examples
|
72
|
+
|
73
|
+
GFM and the "fenced code block" use the following file structure:
|
74
|
+
|
75
|
+
tests/extensions/gfm/README.markdown
|
76
|
+
tests/extensions/gfm/fenced-code-block.md
|
77
|
+
tests/extensions/gfm/fenced-code-block.out
|
78
|
+
|
79
|
+
where `README.markdown` contains:
|
80
|
+
|
81
|
+
https://help.github.com/articles/github-flavored-markdown
|
82
|
+
|
83
|
+
To avoid duplication with other engines, if the input / output (normalized to DOM) is the same across multiple engines use:
|
84
|
+
|
85
|
+
tests/extensions/gfm/fenced-code-block.md [empty]
|
86
|
+
tests/extensions/fenced-code-block.md
|
87
|
+
tests/extensions/fenced-code-block.out
|
88
|
+
|
89
|
+
If the input is the same, and outputs are DOM different, but represent the same idea (e.g. both represent computer code) use:
|
90
|
+
|
91
|
+
tests/extensions/gfm/fenced-code-block.md [empty]
|
92
|
+
tests/extensions/gfm/fenced-code-block.out
|
93
|
+
tests/extensions/fenced-code-block.md
|
94
|
+
tests/extensions/fenced-code-block.out
|
95
|
+
|
96
|
+
#### New Extensions
|
97
|
+
|
98
|
+
Tests are modular, and if you want to test a new engine for your project, that should be easy to do.
|
99
|
+
|
100
|
+
If you feel that the new engine is reasonably popular, please send a pull request adding it.
|
101
|
+
|
102
|
+
## Commits and Pull Requests
|
103
|
+
|
104
|
+
* Keep your commits clean and commented
|
105
|
+
* Do not mix in one commit different things. Keep modifications related.
|
106
|
+
* Do not mix everything in one giant pull request. Create separate pull requests for different topic. That will help to have a more meaningful debate about the pull requests and will help to review the code.
|
107
|
+
* If it relates to a specific issue, add the number of the issue in the commit message.
|
108
|
+
|
109
|
+
Thanks for Contributing
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
TestSuite - Copyright (c) 2013 Karl Dubost
|
4
|
+
Ruby Fork - Copyright (c) 2013 Dave Kinkead
|
5
|
+
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Markdown Test Suite
|
2
|
+
|
3
|
+
## The Ruby Fork
|
4
|
+
|
5
|
+
### Programatically test your markdown parser
|
6
|
+
|
7
|
+
Inspired by questions on [W3C Markdown Community Group](http://www.w3.org/community/markdown).
|
8
|
+
|
9
|
+
Pull Requests are welcome. To improve the `markdown-testsuite` rubygem, fork the ruby branch of this repo. See the [CONTRIBUTING Guidelines](https://github.com/karlcow/markdown-testsuite/blob/master/CONTRIBUTING.md) for additions to the markdown spec.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
First, install the gem and require it...
|
14
|
+
|
15
|
+
require 'markdown-testsuite'
|
16
|
+
|
17
|
+
You can then list all the tests for the core spec...
|
18
|
+
|
19
|
+
Markdown::Testsuite.list
|
20
|
+
# => ["2-paragraphs-hard-return-spaces", "2-paragraphs-hard-return", ...]
|
21
|
+
|
22
|
+
Find out what extensions are supported...
|
23
|
+
|
24
|
+
Markdown::Testsuite.list :extensions
|
25
|
+
# => ["gfm", "kramdown", "multimarkdown", "pandoc", "redcarpet"]
|
26
|
+
|
27
|
+
Or list the tests for an extension...
|
28
|
+
|
29
|
+
Markdown::Testsuite.list :kramdown
|
30
|
+
# => ["fenced-code-block", "utf8"]
|
31
|
+
|
32
|
+
Then generate test objects for a rule, giving you access to its markdown and html form
|
33
|
+
|
34
|
+
img = Markdown::Testsuite.test 'img-title'
|
35
|
+
|
36
|
+
img.md
|
37
|
+
# => "![HTML5](http://www.w3.org/html/logo/img/mark-word-icon.png \"HTML5 logo for everyone\")"
|
38
|
+
|
39
|
+
img.html
|
40
|
+
# => "<p><img src=\"http://www.w3.org/html/logo/img/mark-word-icon.png\" alt=\"HTML5\" title=\"HTML5 logo for everyone\" /></p>"
|
data/Rakefile
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require "markdown/testsuite/version"
|
2
|
+
|
3
|
+
module Markdown
|
4
|
+
module Testsuite
|
5
|
+
|
6
|
+
# Public: Lists all available tests or extensions
|
7
|
+
#
|
8
|
+
# filter_by - The extension as a Symbol
|
9
|
+
#
|
10
|
+
# Examples
|
11
|
+
#
|
12
|
+
# Markdown::Testsuite.list
|
13
|
+
# # => ["2-paragraphs-hard-return-spaces", "2-paragraphs-hard-return", ...]
|
14
|
+
#
|
15
|
+
# Markdown::Testsuite.list :extensions
|
16
|
+
# # => ["gfm", "kramdown", "multimarkdown", "pandoc", "redcarpet"]
|
17
|
+
#
|
18
|
+
# Markdown::Testsuite.list :kramdown
|
19
|
+
# # => ["fenced-code-block", "utf8"]
|
20
|
+
#
|
21
|
+
# Returns the an Array.
|
22
|
+
def self.list(filter_by=:core)
|
23
|
+
tests = []
|
24
|
+
|
25
|
+
if filter_by == :core
|
26
|
+
Dir.glob("#{SPEC_PATH}/*.md").each do |file|
|
27
|
+
file[/specification\/(.+?).md/]
|
28
|
+
tests << $1
|
29
|
+
end
|
30
|
+
else
|
31
|
+
extensions = Dir.glob("#{SPEC_PATH}/extensions/*").map do |file|
|
32
|
+
if File.directory? file
|
33
|
+
file[/specification\/extensions\/(.+?)$/]
|
34
|
+
$1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
extensions.compact!.uniq!
|
38
|
+
|
39
|
+
if filter_by == :extensions
|
40
|
+
tests = extensions
|
41
|
+
elsif
|
42
|
+
Dir.glob("#{SPEC_PATH}/extensions/#{filter_by.to_s}/*.md").each do |file|
|
43
|
+
file[/specification\/extensions\/#{filter_by.to_s}\/(.+?).md/]
|
44
|
+
tests << $1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
tests
|
49
|
+
end
|
50
|
+
|
51
|
+
# Public: Creates a test object for a rule
|
52
|
+
#
|
53
|
+
# rule - A String naming the rule
|
54
|
+
# ext - A Symbol naming the extension
|
55
|
+
#
|
56
|
+
# Examples
|
57
|
+
#
|
58
|
+
# Markdown::Testsuite.test 'img-title'
|
59
|
+
# # => #<Markdown::Testsuite::Test:0x007fc633986240
|
60
|
+
#
|
61
|
+
# Markdown::Testsuite.test 'uf8', :gfm
|
62
|
+
# # => #<Markdown::Testsuite::Test:0x007fc553986240
|
63
|
+
#
|
64
|
+
#
|
65
|
+
# Returns a Test object.
|
66
|
+
def self.test(rule, ext=nil)
|
67
|
+
Markdown::Testsuite::Test.new rule, ext
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'markdown/testsuite/version'
|
2
|
+
|
3
|
+
module Markdown
|
4
|
+
module Testsuite
|
5
|
+
class Test
|
6
|
+
|
7
|
+
attr_reader :md, :html
|
8
|
+
|
9
|
+
def initialize(rule, ext=nil)
|
10
|
+
path = ext.nil? ? "#{SPEC_PATH}/" : "#{SPEC_PATH}/extensions/#{ext.to_s}/"
|
11
|
+
begin
|
12
|
+
@md = File.read "#{path}#{rule}.md"
|
13
|
+
@html = File.read "#{path}#{rule}.out"
|
14
|
+
rescue Exception => e
|
15
|
+
raise Exception.new "Rule #{rule} not found - #{e}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/markdown-spec.html
ADDED
@@ -0,0 +1,315 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Markdown Syntax Specification</title>
|
5
|
+
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
|
6
|
+
<script src='http://darobin.github.com/respec/builds/respec-w3c-common.js' class='remove'></script>
|
7
|
+
<script class='remove'>
|
8
|
+
var respecConfig = {
|
9
|
+
// document info
|
10
|
+
specStatus: "unofficial",
|
11
|
+
shortName: "markdown",
|
12
|
+
// publishDate: "2009-08-06",
|
13
|
+
// previousMaturity: "WD",
|
14
|
+
// previousPublishDate: "2009-03-15",
|
15
|
+
// previousURI : "http://dev.w3.org/2009/dap/ReSpec.js/documentation.html",
|
16
|
+
copyrightStart: "2012",
|
17
|
+
edDraftURI: "http://htmlpreview.github.io/?https://github.com/karlcow/markdown-testsuite/blob/master/markdown-spec.html",
|
18
|
+
// lcEnd: "2010-08-06",
|
19
|
+
|
20
|
+
// editors
|
21
|
+
editors: [
|
22
|
+
{ name: "Karl Dubost", url: "http://www.la-grange.net/karl/",
|
23
|
+
company: "Mozilla", companyURL: "http://www.mozilla.org/" },
|
24
|
+
],
|
25
|
+
|
26
|
+
// WG
|
27
|
+
wg: "Markdown Community Group",
|
28
|
+
wgURI: "http://www.w3.org/community/markdown/",
|
29
|
+
wgPublicList: "public-markdown",
|
30
|
+
wgPatentURI: "",
|
31
|
+
};
|
32
|
+
</script>
|
33
|
+
</head>
|
34
|
+
<body>
|
35
|
+
<section id='abstract'>
|
36
|
+
This specification defines the Markdown syntax, a very simple text markup for giving a minimum of structure to a text and still making it readable.
|
37
|
+
</section>
|
38
|
+
|
39
|
+
<section id='sotd'>
|
40
|
+
<p>
|
41
|
+
This document has not been approved by any group yet. The intent is to produce a strawmann document which can be used by the <a href="http://www.w3.org/community/markdown/">Markdown Community Group</a> for defining what should be in a Markdown Specification.
|
42
|
+
</p>
|
43
|
+
</section>
|
44
|
+
|
45
|
+
<section class='informative'>
|
46
|
+
<h2>Introduction</h2>
|
47
|
+
<p>
|
48
|
+
<dfn>Markdown</dfn> is a text syntax created by John Gruber. etc. The content of the markup defined in this document is based on the initial Markdown Syntax as defined by John Gruber. The document might address syntax extension later on.
|
49
|
+
</p>
|
50
|
+
</section>
|
51
|
+
|
52
|
+
<section id='conformance'>
|
53
|
+
<h2>Conformance Section</h2>
|
54
|
+
<ul>
|
55
|
+
<li>author: (including authoring tools)</li>
|
56
|
+
<li>Markdown parser: </li>
|
57
|
+
<li>HTML producer: </li>
|
58
|
+
</ul>
|
59
|
+
<p class="issue">Define what/who implements the specification.</p>
|
60
|
+
</section>
|
61
|
+
|
62
|
+
<section>
|
63
|
+
<h2>Syntax</h2>
|
64
|
+
<!--template for writing a feature of the language
|
65
|
+
<h3>Feature name</h3>
|
66
|
+
|
67
|
+
<p>A <dfn>feature</dfn> is… [description].</p>
|
68
|
+
|
69
|
+
<h4 class="informative">Examples</h4>
|
70
|
+
|
71
|
+
<pre class="example">Example code</pre>
|
72
|
+
|
73
|
+
<h4>Processing</h4>
|
74
|
+
|
75
|
+
<p>How a parser should process the feature.@describe the step and the unicode character.</p>
|
76
|
+
|
77
|
+
<p class="issue">Describe Issue</p>
|
78
|
+
|
79
|
+
<h4>HTML output</h4>
|
80
|
+
|
81
|
+
<p>What should be the output</p>
|
82
|
+
|
83
|
+
-->
|
84
|
+
|
85
|
+
<h3>End Of Line (EOL) sequence</h3>
|
86
|
+
|
87
|
+
<p>An <dfn>EOL sequence</dfn> consists of all characters and character sequences which can indicate the end of a line of input in a Markdown file.</p>
|
88
|
+
|
89
|
+
<h4>Processing</h4>
|
90
|
+
|
91
|
+
<p>An EOL sequence is defined as any of the following character sequences:</p>
|
92
|
+
|
93
|
+
<ul>
|
94
|
+
<li>LF: Line Feed, U+000A
|
95
|
+
<li>CR: Carriage Return, U+000D
|
96
|
+
<li>CR+LF: CR (U+000D) followed by LF (U+000A)
|
97
|
+
</ul>
|
98
|
+
|
99
|
+
<h5 class="minisuite">Test Cases</h5>
|
100
|
+
|
101
|
+
<ul class="tests">
|
102
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-LF.md">Lines end with LF</a></li>
|
103
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-CR.md">Lines end with CR</a></li>
|
104
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-CR+LF.md">Lines end with CR+LF</a></li>
|
105
|
+
</ul>
|
106
|
+
|
107
|
+
<p class="issue">Should all Unicode characters considered to mean the end of the line be recognized? (see <a href="http://en.wikipedia.org/wiki/Newline">Wikipedia Newline article</a>)</p>
|
108
|
+
<p class="issue">As far as I can tell, embedding different EOL characters in a single text document is not doable by me. I've created separate files to test, but that leaves us in the cold re: example text for this definition. I've included tests for each EOL (to make sure they are detected properly).</p>
|
109
|
+
|
110
|
+
<h4>HTML output</h4>
|
111
|
+
|
112
|
+
<p>The output will be dependent on the block-level element being processed. See (list of block-elements and cross-referenctial anchor tags goes here) for more information.</p>
|
113
|
+
|
114
|
+
<p>For purposes of illustration, all the tests above should result in the following (identical) output.</p>
|
115
|
+
|
116
|
+
<pre>
|
117
|
+
<p>These lines all end with end of line (EOL) sequences.</p>
|
118
|
+
|
119
|
+
<p>Seriously, they really do.</p>
|
120
|
+
|
121
|
+
<p>If you don't believe me: HEX EDIT!</p>
|
122
|
+
</pre>
|
123
|
+
|
124
|
+
<h3>Standalone Paragraph</h3>
|
125
|
+
|
126
|
+
<p>A <dfn>standalone paragraph</dfn> is a unit of text on one or more contiguous lines. Authors can use 0 to 3 leading spaces and 1 trailing space.</p>
|
127
|
+
|
128
|
+
<h4 class="informative">Examples</h4>
|
129
|
+
|
130
|
+
<pre class="example">This is a paragraph on a single line.
|
131
|
+
|
132
|
+
This is another paragraph
|
133
|
+
but on multiple lines.
|
134
|
+
|
135
|
+
This is another way
|
136
|
+
to create paragraphs
|
137
|
+
with leading spaces.</pre>
|
138
|
+
|
139
|
+
<h4>Processing</h4>
|
140
|
+
|
141
|
+
<p>A paragraph starts with 0 to 3 spaces (U+0020) followed by any characters, except the following characters <code>*</code> (U+002A), <code>-</code> (U+002D), <code>+</code> (U+002B), <code>></code>(U+003E).</p>
|
142
|
+
|
143
|
+
<p>A paragraph ends with an EOL sequence followed by:</p>
|
144
|
+
|
145
|
+
<ul>
|
146
|
+
<li>any spaces or tabs and another EOL sequence.</li>
|
147
|
+
<li>or End Of File</li>
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
<p class="issue">Should a parser remove the leading characters spaces.</p>
|
151
|
+
<p class="issue">To test tabs at the ends of a carriage return. See paragraph-trailing-tab.md test.</p>
|
152
|
+
<p class="issue">What is happening to a multiline paragraph when converted to HTML? normalize as a long line, kept as is with the carriage return? What about eventual leading and trailing spaces.</p>
|
153
|
+
|
154
|
+
<h5 class="minisuite">Test Cases</h5>
|
155
|
+
|
156
|
+
<ul class="tests">
|
157
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-hard-return.md">Multilines paragraph</a></li>
|
158
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-line.md">Paragraph on a single long line</a></li>
|
159
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-trailing-leading-spaces.md">Paragraph with 1 leading space and 1 trailing space</a></li>
|
160
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-trailing-tab.md">Paragraph with 1 trailing tab</a></li>
|
161
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-leading-space.md">Paragraph with 1 leading space</a></li>
|
162
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-2-leading-spaces.md">Paragraph with 2 leading spaces</a></li>
|
163
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-3-leading-spaces.md">Paragraph with 3 leading spaces</a></li>
|
164
|
+
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-trailing-spaces.md">Paragraph with 1 trailing space</a></li>
|
165
|
+
</ul>
|
166
|
+
|
167
|
+
<h4>HTML output</h4>
|
168
|
+
|
169
|
+
<p>An HTML producer MUST output a <code>P</code> element start tag followed by the content and MUST end with the <code>P</code> element end tag.</p>
|
170
|
+
|
171
|
+
<p class="issue">Addressing the trailing/leading space characters in the processing or in the HTML output. Maybe better in the processing section to be able to produce in more than one format.</p>
|
172
|
+
|
173
|
+
<h3>Line break</h3>
|
174
|
+
|
175
|
+
<p>A <dfn>line break</dfn> is a way for authors to break a paragraph in the middle. Authors can use two trailing spaces and a return at the end of a line to insert a line break in a paragraph.</p>
|
176
|
+
|
177
|
+
<h4 class="informative">Examples</h4>
|
178
|
+
<pre class="example">This is a paragraph␠␠
|
179
|
+
with an effective line break.</pre>
|
180
|
+
|
181
|
+
<h4>Processing</h4>
|
182
|
+
|
183
|
+
<p>A line break is created when there are two trailing spaces characters (U+0020) followed by an EOL sequence.</p>
|
184
|
+
|
185
|
+
<p class="issue">To test what is happening with 3 or more trailing spaces.</p>
|
186
|
+
<p class="issue">To test what is happening when this is the end of the paragraph. Should it be removed or kept.</p>
|
187
|
+
|
188
|
+
<h4>HTML output</h4>
|
189
|
+
|
190
|
+
<p>An HTML producer MUST output a <code>BR</code> element.</p>
|
191
|
+
|
192
|
+
<h3>Headings</h3>
|
193
|
+
|
194
|
+
<p>A <dfn>heading</dfn> is a string of text for marking up headings with 1 to 6 levels. The heading must be on one and only one line. It must not have any leading space characters. There are 3 ways of marking up headings.</p>
|
195
|
+
|
196
|
+
<dl>
|
197
|
+
<dt>Leading Hash sign</dt>
|
198
|
+
<dd>The author must must put hash sign (<code>#</code>) at the beginning of the line followed by 0 or 1 space and the heading string. 1 hash sign for a level 1 heading to 6 hash signs for a level 6 heading.</dd>
|
199
|
+
<dt>Nesting Hash sign</dt>
|
200
|
+
<dd>In addition to the previous rules for leading hash sign, the author must close with 0 to 1 space and the same number of hash signs <code>#</code>.</dd>
|
201
|
+
<dt>Underlines (<strong>level 1 and 2 only</strong>)</dt>
|
202
|
+
<dd>For level 1 heading, the author must put at the next line after the heading string a series of equal signs (<code>=</code>) of the same length than the heading.</dd>
|
203
|
+
<dd>For level 2 heading, the author must put at the next line after the heading string a series of dash signs (<code>-</code>) of the same length than the heading.</dd>
|
204
|
+
</dl>
|
205
|
+
|
206
|
+
<h4 class="informative">Examples</h4>
|
207
|
+
|
208
|
+
<pre class="example">
|
209
|
+
# Heading level 1
|
210
|
+
## Heading level 2
|
211
|
+
### Heading level 3
|
212
|
+
#### Heading level 4
|
213
|
+
##### Heading level 5
|
214
|
+
###### Heading level 6
|
215
|
+
|
216
|
+
# Heading level 1 #
|
217
|
+
## Heading level 2 ##
|
218
|
+
### Heading level 3 ###
|
219
|
+
#### Heading level 4 ####
|
220
|
+
##### Heading level 5 #####
|
221
|
+
###### Heading level 6 ######
|
222
|
+
|
223
|
+
Heading level 1
|
224
|
+
===============
|
225
|
+
|
226
|
+
Heading level 2
|
227
|
+
---------------
|
228
|
+
</pre>
|
229
|
+
|
230
|
+
<h4>Processing</h4>
|
231
|
+
|
232
|
+
<p>.</p>
|
233
|
+
|
234
|
+
<p class="issue">trailing hash signs are not significant. This has to be explained clearly in the processing part.</p>
|
235
|
+
<p class="issue">leading spaces are forbidden. To check.</p>
|
236
|
+
<p class="issue">Is the length of the undeline string (=, -) significant. To check. Seems not.</p>
|
237
|
+
<p class="issue">Verify the combination of # and underline markup.</p>
|
238
|
+
|
239
|
+
<h4>HTML output</h4>
|
240
|
+
|
241
|
+
<p>What should be the output</p>
|
242
|
+
|
243
|
+
<h3>Reserved characters</h3>
|
244
|
+
|
245
|
+
<p><dfn>Reserved characters</dfn> are used for marking up a markdown prose in some circumstances. It includes backtick <code>`</code>, asterisk <code>*</code>,
|
246
|
+
underscore <code>_</code>, curly braces <code>
|
247
|
+
{}</code>code>, square brackets<code>[]</code>, parentheses <code>()</code>, hash mark <code>#</code>, plus sign <code>+</code>, minus sign (hyphen) <code>-</code>, dot <code>.</code>, exclamation mark <code>!</code>. Their behavior is dependent of the position in the text. Authors can escape these characters with a backslash character (<code>\</code>)</p>
|
248
|
+
|
249
|
+
<h4 class="informative">Examples</h4>
|
250
|
+
|
251
|
+
<pre class="example">\\ backslash
|
252
|
+
\` backtick
|
253
|
+
\* asterisk
|
254
|
+
\_ underscore
|
255
|
+
\{\} curly braces
|
256
|
+
\[\] square brackets
|
257
|
+
\(\) parentheses
|
258
|
+
\# hash mark
|
259
|
+
\+ plus sign
|
260
|
+
\- minus sign (hyphen)
|
261
|
+
\. dot
|
262
|
+
\! exclamation mark</pre>
|
263
|
+
|
264
|
+
<h4>Processing</h4>
|
265
|
+
|
266
|
+
<p>How a parser should process the feature.@describe the step and the unicode character.</p>
|
267
|
+
|
268
|
+
<p class="issue">Describe precisely when the characters is not escaped.</p>
|
269
|
+
<p class="issue">Tests Needed for different circumstances.</p>
|
270
|
+
|
271
|
+
<h4>HTML output</h4>
|
272
|
+
|
273
|
+
<p>The producer tool must output the reserved characters as it is defined.</p>
|
274
|
+
|
275
|
+
</section>
|
276
|
+
|
277
|
+
<section>
|
278
|
+
<h2>Markdown filename extension</h2>
|
279
|
+
|
280
|
+
<p>An extension filename is a common way to identify a file on a Operating System and for authoring tools. Currently there are a number of extensions which have been used in the wild for handling markdown documents. Here is a list of some of these</p>
|
281
|
+
|
282
|
+
<ul>
|
283
|
+
<li>.md</li>
|
284
|
+
<li>.mdown</li>
|
285
|
+
<li>.markdown</li>
|
286
|
+
<li>.mkd</li>
|
287
|
+
<li>.markdn</li>
|
288
|
+
</ul>
|
289
|
+
|
290
|
+
<p class="issue">Should there be only one normative extension filename for everyone to use? And make a note for deprecating the others as parseable but not conformant for producing tools.</p>
|
291
|
+
|
292
|
+
</section>
|
293
|
+
|
294
|
+
<section class="informative">
|
295
|
+
|
296
|
+
<h2>Markup layout style guidelines</h2>
|
297
|
+
<p>Authors and authoring tools are encouraged to use a fixed-width font for editing markdown document. It will be a lot easier to read and write.</p>
|
298
|
+
|
299
|
+
</section>
|
300
|
+
|
301
|
+
<section class='appendix'>
|
302
|
+
<h2>Acknowledgements</h2>
|
303
|
+
|
304
|
+
<p>The editor would like to thank the following persons for contributing and helping in creating this document</p>
|
305
|
+
|
306
|
+
<ul>
|
307
|
+
<li>Many thanks to <a href="http://daringfireball.net/">John Gruber</a> for creating the initial version of <a href="http://daringfireball.net/projects/markdown/">Markdown Syntax</a>.</li>
|
308
|
+
<li>Jeff Atwood for calling out on stabilizing the Markdown syntax. @@link to blog post@@</li>
|
309
|
+
<li><a href="http://www.dpawson.co.uk">Dave Pawson</a> for proposing the W3C Markdown Community Group.</li>
|
310
|
+
<li><a href="http://johnmacfarlane.net/babelmark2/">Babelmark2</a> by <a href="http://johnmacfarlane.net/">John MacFarlane</a> has been essential to stay in sync with the reality of current implementations.</li>
|
311
|
+
</ul>
|
312
|
+
</section>
|
313
|
+
|
314
|
+
</body>
|
315
|
+
</html>
|