Code Monkey home page Code Monkey logo

convert's Introduction

Convert strings and HTML to links and embedded content

Convert any string or HTML to links and embedded content from a long list of providers and libraries.

Installation

gem install convert

or add to Gemfile.

Usage

# Require convert if you're not using bundler
require 'convert'

# Run default converters. Pass :converters => [:auto_link, :decode]
Convert.run('string')

# Convert with Nokogiri, used by 'run'
Convert.scan('HTML string')

# URL to HTML link
Convert.auto_link('https://crowdfundhq.com')

# Embed dailymotion videos (https://dailymotion.com)
Convert.dailymotion('string')

# Decode HTML, opposite of below
Convert.decode('string')

# Encode HTML with HTMLEntities
Convert.encode('string')

# Remove embedded videos from emails
Convert.email_escape('string')

# Embed facebook video (https://www.facebook.com)
Convert.facebook_embed('string')

# Embed flickr content (https://flickr.com)
Convert.flickr('string')

# Embed a Github gist (https://gist.github.com)
Convert.gist('string')

# Embed classic google maps (https://maps.google.com)
Convert.google_maps('string')

# Twitter or Facebook hastag to HTML link
Convert.hashtag('#flat')

# Escape HTML
Convert.escape_html('html')

# Unescape HTML
Convert.unescape_html('string')

# Embed iframe
Convert.iframe_embed('https://crowdfundhq.com/campaigns/flatty.embed')

# Convert
Convert.image_tag('https://crowdfundhq.com/logo.png')

# URL to Instagram embedded content
Convert.instagram('string')

# String to markdown (https://kramdown.gettalong.org)
Convert.kramdown('string')

# Embed live leak videos
Convert.liveleak('string')

# Embed markdown with Redcarpet
Convert.redcarpet('string')

# Sanitize HTML with the Sanitize gem
Convert.sanitize('HTML string')

# Sanitize config: :custom, :full, :linebreaks, :simple, :restricted, :basic, :relaxed
# You can add your own config by adding a file like the ones here:
# https://github.com/fugroup/convert/tree/master/lib/sanitizers
Convert.sanitize('HTML string', :config => :custom)

# Strip parameters from URL
Convert.strip_params('URL string')

# Same as above, a few other options
Convert.markdown('string')

# Embed metacafe content (https://www.metacafe.com)
Convert.metacafe('string')

# New lines to HTML br tags
Convert.simple_format('string')

# Embed Soundcloud music (https://soundcloud.com)
Convert.soundcloud('string')

# Embed TED videos (https://www.ted.com)
Convert.ted('string')

# Twitter embed tweet (https://twitter.com)
Convert.twitter('string')

# Embed Youtube or Vimeo videos from URL
Convert.video_embed('string')

# Embed Vimeo video, full (https://vimeo.com)
Convert.vimeo('string')

# Embed Vimeo video, simple
Convert.vimeo_embed('string')

# Embed worldstar content
Convert.worldstar('string')

# Embed Youtube videos, full (https://youtube.com)
Convert.youtube('string')

# Embed Youtube videos, simple
Convert.youtube_embed('string')

# Embed Youtube image
Convert.youtube_image('string')

# Embed Youtube JS API
Convert.youtube_js_api('string')

# Convert Chinese and other non-standard characters to IDN
Convert.to_ascii('string')

# Reverse IDN conversion
Convert.to_unicode('string')

Created and maintained by Fugroup Ltd. We are the creators of CrowdfundHQ.

@authors: Vidar

convert's People

Contributors

fugroup avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

convert's Issues

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.