def htmlify(text, markup = options[:markup])
return text unless markup
load_markup_provider(markup)
case markup
when :markdown
html = markup_class(markup).new(text).to_html
when :textile
doc = markup_class(markup).new(text)
doc.hard_breaks = false if doc.respond_to?(:hard_breaks=)
html = doc.to_html
when :rdoc
html = MarkupHelper::SimpleMarkup.convert(text, SimpleMarkupHtml)
html = fix_dash_dash(html)
html = fix_typewriter(html)
end
html = resolve_links(html)
html = html.gsub(/<pre>(?:\s*<code>)?(.+?)(?:<\/code>\s*)?<\/pre>/m) do
str = $1
str = html_syntax_highlight(CGI.unescapeHTML(str)) unless options[:no_highlight]
%Q{<pre class="code">#{str}</pre>}
end
html
end