all repos — markup @ 8444bdc5b26f29ee62c1c100cc377534d23bb6a9

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

 1MD_FILES = /md|mkdn?|mdwn|mdown|markdown/
 2
 3if markup('github/markdown', MD_FILES) do |content|
 4    GitHub::Markdown.render(content)
 5  end
 6elsif markup(:redcarpet, MD_FILES) do |content|
 7    RedcarpetCompat.new(content).to_html
 8  end 
 9elsif markup(:rdiscount, MD_FILES) do |content|
10    RDiscount.new(content).to_html
11  end 
12elsif markup(:maruku, MD_FILES) do |content|
13    Maruku.new(content).to_html
14  end 
15elsif markup(:kramdown, MD_FILES) do |content|
16    Kramdown::Document.new(content).to_html
17  end
18elsif markup(:bluecloth, MD_FILES) do |content|
19    BlueCloth.new(content).to_html
20  end
21end
22
23markup(:redcloth, /textile/) do |content|
24  RedCloth.new(content).to_html
25end
26
27markup('github/markup/rdoc', /rdoc/) do |content|
28  GitHub::Markup::RDoc.new(content).to_html
29end
30
31markup('org-ruby', /org/) do |content|
32  Orgmode::Parser.new(content).to_html
33end
34
35markup(:creole, /creole/) do |content|
36  Creole.creolize(content)
37end
38
39markup(:wikicloth, /mediawiki|wiki/) do |content|
40  WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true)
41end
42
43markup(:literati, /lhs/) do |content|
44  Literati.render(content)
45end
46
47command(:rest2html, /re?st(\.txt)?/)
48
49command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
50
51# pod2html is nice enough to generate a full-on HTML document for us,
52# so we return the favor by ripping out the good parts.
53#
54# Any block passed to `command` will be handed the command's STDOUT for
55# post processing.
56command("/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go", /pod/) do |rendered|
57  if rendered =~ /<!-- start doc -->\s*(.+)\s*<!-- end doc -->/mi
58    $1
59  end
60end