# Upskirt is an implementation of John Gruber's Markdown markup
# language. Upskirt is safe, fast and production ready.
#
# Redcarpet is Upskirt with a touch of Ruby. It is mostly based on Ryan
# Tomayko's RDiscount, and inspired by Rick Astley wearing a kilt.
#
# Redcarpet is a drop-in replacement for BlueCloth, RedCloth and RDiscount.
#
# == Usage
#
# Redcarpet implements the basic protocol popularized by RedCloth and adopted
# by BlueCloth:
# require 'redcarpet'
# markdown = Redcarpet.new("Hello World!")
# puts markdown.to_html
#
# == Replacing BlueCloth
#
# Inject Redcarpet into your BlueCloth-using code by replacing your bluecloth
# require statements with the following:
# begin
# require 'redcarpet'
# BlueCloth = Redcarpet
# rescue LoadError
# require 'bluecloth'
# end
#
class Redcarpet
VERSION = '1.2.2'
# Original Markdown formatted text.
attr_reader :text
# Set true to have smarty-like quote translation performed.
attr_accessor :smart
# Do not output tags included in the source text.
attr_accessor :filter_styles
attr_accessor :fold_lines # Ignore, just for compatibility
# Do not output any raw HTML included in the source text.
attr_accessor :filter_html
# Do not process ![] and remove tags from the output.
attr_accessor :no_image
# Do not process [] and remove tags from the output.
attr_accessor :no_links
# Disable superscript and relaxed emphasis processing.
attr_accessor :strict
# Convert URL in links, even if they aren't encased in <>
attr_accessor :autolink
# Don't make hyperlinks from [][] links that have unknown URL types.
attr_accessor :safelink
# Add TOC anchors to every header
attr_accessor :generate_toc
def initialize(text, *extensions)
@text = text
extensions.each { |e| send("#{e}=", true) }
end
end
Markdown = Redcarpet unless defined? Markdown
require 'redcarpet.so'