Want to contribute? Great!
- Fork it.
- Create a branch (
git checkout -b my_markup
) - Commit your changes (
git commit -am "Added Snarkdown"
) - Push to the branch (
git push origin my_markup
) - Open a Pull Request
- Enjoy a refreshing Diet Coke and wait
There are two ways to add markups.
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 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 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.
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.
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!
If you are the current maintainer of this gem:
- Bump the version number in
lib/github-markup.rb
, adhering to Semantic Versioning - Update
HISTORY.md
- Test the latest version on GitHub
- Build the new version with
rake build
- Copy
pkg/github-markup*.gem
tovendor/cache
in your local checkout of GitHub - Update the version for
github-markup
in theGemfile
- Run
bundle update --local github-markup
- Run any relevant tests and test it manually from the browser.
- Push the new gem release with
rake release
. If you don't have permission to release to rubygems.org, contact one of the existing owners (gem owners github-markup
) and ask them to add you.