https://github.com/vmg/rinku
Autolinking. Ruby. Yes, that's pretty much it.
https://github.com/vmg/rinku
Keywords from Contributors
activejob activerecord mvc libgit2 rack ruby-gem rubygem rubocop debugger sinatra
Last synced: about 15 hours ago
JSON representation
Repository metadata
Autolinking. Ruby. Yes, that's pretty much it.
- Host: GitHub
- URL: https://github.com/vmg/rinku
- Owner: vmg
- License: isc
- Created: 2011-06-09T01:27:17.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2024-02-07T18:22:23.000Z (almost 2 years ago)
- Last Synced: 2025-11-28T08:53:53.808Z (14 days ago)
- Language: C
- Homepage:
- Size: 158 KB
- Stars: 598
- Watchers: 9
- Forks: 69
- Open Issues: 19
- Releases: 0
-
Metadata Files:
- Readme: README.markdown
- License: COPYING
README.markdown
Rinku does linking
Rinku is a Ruby library that does autolinking.
It parses text and turns anything that remotely resembles a link into an HTML link,
just like the Ruby on Rails auto_link method -- but it's about 20 times faster,
because it's written in C, and it's about 20 times smarter when linking,
because it does actual parsing instead of RegEx replacements.
Rinku is a Ruby Gem
Rinku is available as a Ruby gem:
$ [sudo] gem install rinku
The Rinku source is available at GitHub:
$ git clone git://github.com/vmg/rinku.git
Rinku is a standalone library
It exports a single method called Rinku.auto_link.
require 'rinku'
Rinku.auto_link(text, mode=:all, link_attr=nil, skip_tags=nil)
Rinku.auto_link(text, mode=:all, link_attr=nil, skip_tags=nil) { |link_text| ... }
Parses a block of text looking for "safe" urls or email addresses,
and turns them into HTML links with the given attributes.
NOTE: The block of text may or may not be HTML; if the text is HTML,
Rinku will skip the relevant tags to prevent double-linking and linking
inside pre blocks by default.
NOTE: If the input text is HTML, it's expected to be already escaped.
Rinku will perform no escaping.
NOTE: Currently the follow protocols are considered safe and are the
only ones that will be autolinked.
http:// https:// ftp:// mailto://
Email addresses are also autolinked by default. URLs without a protocol
specifier but starting with 'www.' will also be autolinked, defaulting to
the 'http://' protocol.
-
textis a string in plain text or HTML markup. If the string is formatted in
HTML, Rinku is smart enough to skip the links that are already enclosed in<a>
tags.` -
modeis a symbol, either:all,:urlsor:email_addresses,
which specifies which kind of links will be auto-linked. -
link_attris a string containing the link attributes for each link that
will be generated. These attributes are not sanitized and will be include as-is
in each generated link, e.g.auto_link('http://www.pokemon.com', :all, 'target="_blank"') # => '<a href="http://www.pokemon.com" target="_blank">http://www.pokemon.com</a>'This string can be autogenerated from a hash using the Rails
tag_optionshelper. -
skip_tagsis a list of strings with the names of HTML tags that will be skipped
when autolinking. Ifnil, this defaults to the value of the globalRinku.skip_tags,
which is initially["a", "pre", "code", "kbd", "script"]. -
&blockis an optional block argument. If a block is passed, it will
be yielded for each found link in the text, and its return value will be used instead
of the name of the link. E.g.auto_link('Check it out at http://www.pokemon.com') do |url| "THE POKEMAN WEBSITEZ" end # => 'Check it out at <a href="http://www.pokemon.com">THE POKEMAN WEBSITEZ</a>'
Rinku is a drop-in replacement for Rails 3.1 auto_link
Auto-linking functionality has been removed from Rails 3.1,
and is instead offered as a standalone gem, rails_autolink. You can
choose to use Rinku instead.
require 'rails_rinku'
include ActionView::Helpers::TextHelper
post_body = "Welcome to my new blog at http://www.myblog.com/."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>."
The rails_rinku package monkeypatches Rails with an auto_link method that
mimics 100% the original one, parameter per parameter. It's just faster.
Developing
$ gem install rake-compiler
$ rake
Rinku is written by me
I am Vicent Marti, and I wrote Rinku.
While Rinku is busy doing autolinks, you should be busy following me on twitter.
@vmg. Do it.
Rinku has an awesome license
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Owner metadata
- Name: Vicent Martí
- Login: vmg
- Email:
- Kind: user
- Description: Working on perf @planetscale. Previously: Principal Systems Engineer @github (this website, yo).
- Website: http://twitter.com/vmg
- Location: Madrid
- Twitter:
- Company: @planetscale
- Icon url: https://avatars.githubusercontent.com/u/42793?u=9dd4373b42a0baffff49c7bbf7b1c7c324806f75&v=4
- Repositories: 107
- Last ynced at: 2023-04-12T20:27:21.185Z
- Profile URL: https://github.com/vmg
GitHub Events
Total
- Watch event: 3
- Issue comment event: 1
- Pull request event: 1
Last Year
- Watch event: 2
- Issue comment event: 1
- Pull request event: 1
Committers metadata
Last synced: 8 days ago
Total Commits: 102
Total Committers: 17
Avg Commits per committer: 6.0
Development Distribution Score (DDS): 0.539
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Vicent Marti | t****u@g****m | 47 |
| Ashe Connor | a****e@k****e | 11 |
| Yuki Izumi | k****k@g****m | 9 |
| Ryan Waldron | r****w@e****m | 6 |
| Ken Dreyer | k****r@k****m | 5 |
| Rick Bradley | b****y@g****m | 5 |
| Michael Grosser | m****l@g****t | 5 |
| Ryan Tomayko | r****o@g****m | 3 |
| Henare Degan | h****n@g****m | 2 |
| Ikumi Shimizu | i****u@d****p | 2 |
| Benjamin Quorning | b****g@z****m | 1 |
| Brian Lopez | s****z@g****m | 1 |
| Howard Wilson | h****d@w****t | 1 |
| Shajith Chacko | s****h@z****m | 1 |
| Simon Rozet | s****n@r****e | 1 |
| Vicent Martí | v****t@g****m | 1 |
| Waldir Pimenta | w****s@g****m | 1 |
Committer domains:
- github.com: 3
- zendesk.com: 2
- rozet.name: 1
- watsonbox.net: 1
- dwango.co.jp: 1
- grosser.it: 1
- ktdreyer.com: 1
- erebor.com: 1
- kivikakk.ee: 1
Issue and Pull Request metadata
Last synced: 24 days ago
Total issues: 46
Total pull requests: 51
Average time to close issues: about 1 year
Average time to close pull requests: 5 months
Total issue authors: 44
Total pull request authors: 29
Average comments per issue: 1.93
Average comments per pull request: 1.73
Merged pull request: 26
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: 1 minute
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 1.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- rtomayko (2)
- bquorning (2)
- jrochkind (1)
- headius (1)
- paladini (1)
- Paxa (1)
- eltonokada (1)
- meandkareem (1)
- patbl (1)
- aguynamedben (1)
- MaffooClock (1)
- ottost (1)
- ncri (1)
- ahorek (1)
- svoop (1)
Top Pull Request Authors
- grosser (9)
- kivikakk (5)
- ktdreyer (4)
- rtomayko (4)
- brianmario (2)
- dbuchi (2)
- shajith (2)
- benkoshy (2)
- sloser (1)
- Floppy (1)
- kerrizor (1)
- 193s (1)
- henare (1)
- marius-balteanu (1)
- staugaard (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 3
-
Total downloads:
- rubygems: 105,628,738 total
- Total docker downloads: 949,355,692
- Total dependent packages: 42 (may contain duplicates)
- Total dependent repositories: 4,700 (may contain duplicates)
- Total versions: 58
- Total maintainers: 2
gem.coop: rinku
A fast and very smart autolinking library that acts as a drop-in replacement for Rails `auto_link`
- Homepage: https://github.com/vmg/rinku
- Documentation: http://www.rubydoc.info/gems/rinku/
- Licenses: ISC
- Latest release: 2.0.6 (published over 6 years ago)
- Last Synced: 2025-12-08T20:01:53.034Z (4 days ago)
- Versions: 21
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 52,809,881 Total
- Docker Downloads: 474,677,846
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.161%
- Downloads: 0.483%
- Maintainers (2)
rubygems.org: rinku
A fast and very smart autolinking library that acts as a drop-in replacement for Rails `auto_link`
- Homepage: https://github.com/vmg/rinku
- Documentation: http://www.rubydoc.info/gems/rinku/
- Licenses: ISC
- Latest release: 2.0.6 (published over 6 years ago)
- Last Synced: 2025-12-09T09:32:27.927Z (3 days ago)
- Versions: 21
- Dependent Packages: 42
- Dependent Repositories: 4,700
- Downloads: 52,818,857 Total
- Docker Downloads: 474,677,846
-
Rankings:
- Docker downloads count: 0.269%
- Dependent repos count: 0.465%
- Downloads: 0.543%
- Dependent packages count: 0.61%
- Average: 1.225%
- Stargazers count: 2.315%
- Forks count: 3.15%
- Maintainers (2)
proxy.golang.org: github.com/vmg/rinku
- Homepage:
- Documentation: https://pkg.go.dev/github.com/vmg/rinku#section-documentation
- Licenses: isc
- Latest release: v2.0.6+incompatible (published over 6 years ago)
- Last Synced: 2025-12-07T18:05:07.169Z (5 days ago)
- Versions: 16
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 2.492%
- Forks count: 3.044%
- Average: 6.469%
- Dependent packages count: 9.56%
- Dependent repos count: 10.779%
Dependencies
- minitest >= 5.0 development
- rake >= 0 development
- rake-compiler >= 0 development
Score: 30.03487911965481