Skip to content

codetree/html-pipeline-linkify_github

 
 

Repository files navigation

HTML::Pipeline::LinkifyGitHub

Gem Version Build Status Code Climate

HTML::Pipeline::LinkifyGitHub provides a HTML::Pipeline filter to autolink GitHub urls.

Installation

Add this line to your application's Gemfile:

gem "html-pipeline-linkify_github"

And then execute:

$ bundle

Or install it yourself as:

$ gem install html-pipeline-linkify_github

Usage

Use HTML::Pipeline::LinkifyGitHubFilter filter after your markdown filter.

require "html/pipeline"
require "html/pipeline/linkify_github"

pipeline = HTML::Pipeline.new [
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::LinkifyGitHubFilter
]

result = pipeline.call <<-MARKDOWN.strip_heredoc
  https://github.com/rails/rails/pull/21862
  https://github.com/rails/rails/issues/21843
  https://github.com/rails/rails/commit/67597e1719ec6af7e22964603cc77aa5b085a864
MARKDOWN

puts result[:output].to_html

prints:

<p><a href="https://github.com/rails/rails/pull/21862">rails/rails#21862</a><br>
<a href="https://github.com/rails/rails/issues/21843">rails/rails#21843</a><br>
<a href="https://github.com/rails/rails/commit/67597e1719ec6af7e22964603cc77aa5b085a864">rails/rails@`67597e`</a></p>

Notes

This RubyGem requires Ruby 2.0+ because support for 1.9.3 is officially end.

Contributing

Please see the CONTRIBUTING.md file.

Credits

A huge THANK YOU to all our contributors! ❤️

License

Please see the LICENSE.md file.

Maintained by Jolly Good Code

Jolly Good Code

We specialise in rapid development of high quality MVPs. Hire us to turn your product idea into reality.