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