all repos — markup @ dd1b9eb2730fe5cdca75eae0cfc7a9fd69d6d8a2

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
47markup(:asciidoctor, /asc|adoc|asciidoc/) do |content|
48  Asciidoctor::Document.new(content).render
49end
50
51command(:rest2html, /re?st(\.txt)?/)
52
53# pod2html is nice enough to generate a full-on HTML document for us,
54# so we return the favor by ripping out the good parts.
55#
56# Any block passed to `command` will be handed the command's STDOUT for
57# post processing.
58command("/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go", /pod/) do |rendered|
59  if rendered =~ /<!-- start doc -->\s*(.+)\s*<!-- end doc -->/mi
60    $1
61  end
62end