all repos — markup @ 1a9d3f9f28ae7655e50f242e21086d9583ba253e

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(nil, 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