You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge remote-tracking branch 'origin/master' into implementation-name
* origin/master: (57 commits)
tweaks
Call out CSS issues
Fix link to linguist
Release 1.3.3
The command is POSIX, not Posix
Release 1.3.2
Spruce up old tests
Add empty `a` to support contents with sectnums
Add comments to describe these calls
No longer true
Restore "test" as the default rake task
point to other places before creating issues
Extconf hack no longer necessary
Don't test jdk7
Fallback on open3 if posix-spawn is unavailable.
Define CommandImplementation#execute conditional on presence of Posix::Spawn
Get html_equal tests running with minitest
Updated deprecated .exists? in markup.rb
Added the link to Pod::Simple on CPAN.
Fix pod output
...
Conflicts:
lib/github/markup.rb
test/markup_test.rb
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+12-47
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,16 @@
1
1
# Contributing
2
2
3
-
Want to contribute? Great!
3
+
This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com).
4
+
5
+
If you are having an issue with:
6
+
7
+
***Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting)
Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction.
12
+
13
+
## Submitting a Pull Request
4
14
5
15
1. Fork it.
6
16
2. Create a branch (`git checkout -b my_markup`)
@@ -9,57 +19,12 @@ Want to contribute? Great!
9
19
5. Open a [Pull Request][1]
10
20
6. Enjoy a refreshing Diet Coke and wait
11
21
12
-
13
-
There are two ways to add markups.
14
-
15
-
### Commands
16
-
17
-
If your markup is in a language other than Ruby, drop a translator
18
-
script in `lib/github/commands` which accepts input on STDIN and
19
-
returns HTML on STDOUT. See [rest2html][r2h] for an example.
20
-
21
-
Once your script is in place, edit `lib/github/markups.rb` and tell
22
-
GitHub Markup about it. Again we look to [rest2html][r2hc] for
23
-
guidance:
24
-
25
-
command(:rest2html, /re?st(.txt)?/)
26
-
27
-
Here we're telling GitHub Markup of the existence of a `rest2html`
28
-
command which should be used for any file ending in `rest`,
29
-
`rst`, `rest.txt` or `rst.txt`. Any regular expression will do.
30
-
31
-
Finally add your [tests](#testing).
32
-
33
-
### Classes
34
-
35
-
If your markup can be translated using a Ruby library, that's
36
-
great. Check out `lib/github/markups.rb` for some
37
-
examples. Let's look at Markdown:
38
-
39
-
markup(:markdown, /md|mkdn?|markdown/) do |content|
40
-
Markdown.new(content).to_html
41
-
end
42
-
43
-
We give the `markup` method three bits of information: the name of the
44
-
file to `require`, a regular expression for extensions to match, and a
45
-
block to run with unformatted markup which should return HTML.
46
-
47
-
If you need to monkeypatch a RubyGem or something, check out the
48
-
included RDoc example.
49
-
50
-
Finally add your [tests](#testing).
51
-
52
-
### Testing
22
+
## Testing
53
23
54
24
To run the tests:
55
25
56
26
$ rake
57
27
58
-
When adding support for a new markup library, create a `README.extension` in `test/markups` along with a `README.extension.html`. As you may imagine, the `README.extension` should be your known input and the
59
-
`README.extension.html` should be the desired output.
We use this library on GitHub when rendering your README or any other
5
-
rich text file. The generated HTML is then run through filters in the [html-pipeline](https://github.com/jch/html-pipeline) to perform things like [sanitization](#html-sanitization) and [syntax highlighting](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/syntax_highlight_filter.rb).
4
+
This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com:
5
+
6
+
0. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below.
7
+
0. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist.
8
+
0. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting.
9
+
0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb).
10
+
0. The resulting HTML is rendered on GitHub.com.
11
+
12
+
Please see our [contributing guidelines](CONTRIBUTING.md) before reporting an issue.
6
13
7
14
Markups
8
15
-------
@@ -19,7 +26,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
29
+
comes with Perl >= 5.10. Lower versions should install [Pod::Simple](http://search.cpan.org/~dwheeler/Pod-Simple-3.28/lib/Pod/Simple.pod) from CPAN.
23
30
24
31
Installation
25
32
-----------
@@ -41,32 +48,3 @@ Contributing
41
48
------------
42
49
43
50
See [Contributing](CONTRIBUTING.md)
44
-
45
-
HTML sanitization
46
-
-----------------
47
-
48
-
HTML rendered by the various markup language processors gets passed through an [HTML sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for security reasons. HTML elements not in the whitelist are removed. HTML attributes not in the whitelist are removed from the preserved elements.
49
-
50
-
The following HTML elements, organized by category, are whitelisted:
0 commit comments