-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #431 from github/trim-contributing
Make docs more helpful for end-users
- Loading branch information
Showing
2 changed files
with
21 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
# Contributing | ||
|
||
Want to contribute? Great! | ||
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). | ||
|
||
If you are having an issue with: | ||
|
||
* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) | ||
* **Markdown on GitHub** - contact [email protected] | ||
* **Styling issues on GitHub** - contact [email protected] | ||
|
||
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. | ||
|
||
## Submitting a Pull Request | ||
|
||
1. Fork it. | ||
2. Create a branch (`git checkout -b my_markup`) | ||
|
@@ -9,57 +19,12 @@ Want to contribute? Great! | |
5. Open a [Pull Request][1] | ||
6. Enjoy a refreshing Diet Coke and wait | ||
|
||
|
||
There are two ways to add markups. | ||
|
||
### Commands | ||
|
||
If your markup is in a language other than Ruby, drop a translator | ||
script in `lib/github/commands` which accepts input on STDIN and | ||
returns HTML on STDOUT. See [rest2html][r2h] for an example. | ||
|
||
Once your script is in place, edit `lib/github/markups.rb` and tell | ||
GitHub Markup about it. Again we look to [rest2html][r2hc] for | ||
guidance: | ||
|
||
command(:rest2html, /re?st(.txt)?/) | ||
|
||
Here we're telling GitHub Markup of the existence of a `rest2html` | ||
command which should be used for any file ending in `rest`, | ||
`rst`, `rest.txt` or `rst.txt`. Any regular expression will do. | ||
|
||
Finally add your [tests](#testing). | ||
|
||
### Classes | ||
|
||
If your markup can be translated using a Ruby library, that's | ||
great. Check out `lib/github/markups.rb` for some | ||
examples. Let's look at Markdown: | ||
|
||
markup(:markdown, /md|mkdn?|markdown/) do |content| | ||
Markdown.new(content).to_html | ||
end | ||
|
||
We give the `markup` method three bits of information: the name of the | ||
file to `require`, a regular expression for extensions to match, and a | ||
block to run with unformatted markup which should return HTML. | ||
|
||
If you need to monkeypatch a RubyGem or something, check out the | ||
included RDoc example. | ||
|
||
Finally add your [tests](#testing). | ||
|
||
### Testing | ||
## Testing | ||
|
||
To run the tests: | ||
|
||
$ rake | ||
|
||
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 | ||
`README.extension.html` should be the desired output. | ||
|
||
Now run the tests: `rake` | ||
|
||
If nothing complains, congratulations! | ||
|
||
## Releasing a new version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters