Generates HTML from the Textile contents.
r = RedCloth.new( "And then? She *fell*!" ) r.to_html( true ) #=>"And then? She <strong>fell</strong>!"
Source Code
# File redcloth.rb, line 266 def to_html( *rules ) rules = DEFAULT_RULES if rules.empty? # make our working copy text = self.dup @urlrefs = {} @shelf = [] textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists, :block_textile_prefix, :inline_textile_image, :inline_textile_link, :inline_textile_code, :inline_textile_span, :glyphs_textile] markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule, :block_markdown_bq, :block_markdown_lists, :inline_markdown_reflink, :inline_markdown_link] @rules = rules.collect do |rule| case rule when :markdown markdown_rules when :textile textile_rules else rule end end.flatten # standard clean up incoming_entities text clean_white_space text # start processor @pre_list = [] rip_offtags text no_textile text hard_break text unless @lite_mode refs text blocks text end inline text smooth_offtags text retrieve text text.gsub!( /<\/?notextile>/, '' ) text.gsub!( /x%x%/, '&' ) clean_html text if filter_html text.strip! text end
<code/>and<pre/>for code samples.