all repos — markup @ 1fe9828ef58df39e331dc59fced1dad36fc23995

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