Socket
Book a DemoInstallSign in
Socket

albeano

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

albeano

1.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Albeano

Installation

You need to ensure you have Pygments syntax highlighter installed on your system and your application has access to the pygmentize executable. Then it's as easy as:

gem install albeano

Usage

Albeano takes your orginal text and strips out the [code] style snippets producing a nicely formatted document with HTML syntax highlighted code inserts. Perfect for embedding code into blog posts.

Albeano.generate(text)
Albeano.generate(File.new(path_to_file))

You can even have it return markdown. Just make sure you have RDiscount installed

Albeano.new(text).to_markdown
Albeano.new(text).to_markdown(:smart, :filter_html)

Rails 3

You can easily incorporate Albeano into your existing Rails applications, just add albeano to your Gemfile.

You can then add a method do your models (assuming body contains the body of your post or text):

class Post < ActiveRecord::Base
  def content
    Albeano.generate(body)
  end

  # with markdown
  def content
    Albeano.new(body).to_markdown
  end
end

You can of course use these methods inside of your views, too. Remember to use the html_safe method before rendering your markup, otherwise your HTML will be escaped and rendered as entities.

FAQs

Package last updated on 20 May 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.