all repos — markup @ v0.7.0

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

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