all repos — markup @ 9dd2a32a2cabbc9083c0c646373cd0663981c451

The code we use to render README.your_favorite_markup

lib/github/markup/rdoc.rb (view raw)

 1require 'rdoc/generators/html_generator'
 2
 3module GitHub
 4  module Markup
 5    class RDoc
 6      def initialize(content)
 7        @content = content
 8      end
 9
10      def to_html
11        simple_markup = SM::SimpleMarkup.new
12        generator = Generators::HyperlinkHtml.new(nil, OpenStruct.new)
13        simple_markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
14        simple_markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
15        simple_markup.convert(@content, generator)
16      end
17    end
18  end
19end