All Projects â†’ crystal-community â†’ autolink.cr

crystal-community / autolink.cr

Licence: MIT license
🔗 Auto link for Crystal

Programming Languages

crystal
512 projects

Labels

Projects that are alternatives of or similar to autolink.cr

ngx-linkifyjs
Angular V8 wrapper for linkifyjs - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs
Stars: ✭ 40 (+150%)
Mutual labels:  autolink
Socially
Socially is a textView which is able to create separate clickable views according to your requirements.
Stars: ✭ 28 (+75%)
Mutual labels:  autolink
react-native-fast-openpgp
OpenPGP for react native made with golang for fast performance
Stars: ✭ 29 (+81.25%)
Mutual labels:  autolink
remark-autolink-headings
Legacy remark plugin to automatically add links to headings — please use `rehype-autolink-headings` instead
Stars: ✭ 63 (+293.75%)
Mutual labels:  autolink

🔗 Autolink Build Status

Autolink.cr is a Crystal shard that automatically turns URLs into links.

Example:

auto_link("Welcome to my profile https://github.com/hugoabonizio")
# => Welcome to my profile <a href="https://github.com/hugoabonizio">https://github.com/hugoabonizio</a>

Installation

Add this to your application's shard.yml:

dependencies:
  autolink:
    github: crystal-community/autolink.cr

Usage

require "autolink"

include Autolink

auto_link("My blog: http://www.myblog.com/", html: {"class" => "menu", "target" => "_blank"})
# => My blog: <a href="http://www.myblog.com/" class="menu" target="_blank">http://www.myblog.com/</a>

Simple autolink

Without providing any HTML options autolink.cr will just wrap the URL with <a> tag.

Autolink.auto_link("Welcome to my new blog at http://www.myblog.com/")
# => Welcome to my new blog at <a href="http://www.myblog.com/">http://www.myblog.com/</a>

Custom tag attributes

The <a> tag can receive custom attributes.

Autolink.auto_link("My blog: http://www.myblog.com/", html: {"class" => "menu", "target" => "_blank"})
# => My blog: <a href="http://www.myblog.com/" class="menu" target="_blank">http://www.myblog.com/</a>

Contributing

  1. Fork it ( https://github.com/crystal-community/autolink.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

This project is a port to Crystal of rails_autolink Ruby gem. Thanks to all its contributors.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].