def htmlify(text, markup = options[:markup])
markup_meth = "html_markup_#{markup}"
return text unless respond_to?(markup_meth)
return "" unless text
return text unless markup
load_markup_provider(markup)
html = send(markup_meth, text)
if html.respond_to?(:encode)
html = html.force_encoding(text.encoding)
html = html.encode(:invalid => :replace, :replace => '?')
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 unless markup == :text
html
end