all repos — markup @ 0fc0c66e3fc44f2b321d5485bd39682bf4555e21

The code we use to render README.your_favorite_markup

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

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