Code Monkey home page Code Monkey logo

html-pipeline-linkify_github's Introduction

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.

html-pipeline-linkify_github's People

Contributors

juanitofatas avatar winston avatar

Stargazers

 avatar Derrick Reimer avatar  avatar Shawn avatar  avatar

Watchers

Chew Choon Keat avatar James Cloos avatar Rachel Morrell avatar  avatar  avatar

html-pipeline-linkify_github's Issues

Should not linkify url inside markdown link

Fix these tests:

  def test_does_not_linkify_inside_markdown_link
    text = "[rails/rails#925](http://www.github.com/rails/rails/issues/925)"

    assert_equal "[rails/rails#925](http://www.github.com/rails/rails/issues/925)", filter(text)
  end

  def test_linkify_inside_parens
    text = "the issue (http://www.github.com/rails/rails/issues/925)"

    assert_equal "the issue ([rails/rails#925](http://www.github.com/rails/rails/issues/925))", filter(text)
  end

Should skip linkify when it is a markdown link.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.