all repos — markup @ f6f0e0b580edd0bdefc1232775be59ffaa2e3f8d

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

 1require "github/markup/markdown"
 2
 3@@markups << GitHub::Markup::Markdown.new
 4
 5markup(:redcloth, /textile/) do |content|
 6  RedCloth.new(content).to_html
 7end
 8
 9markup('github/markup/rdoc', /rdoc/) do |content|
10  GitHub::Markup::RDoc.new(content).to_html
11end
12
13markup('org-ruby', /org/) do |content|
14  Orgmode::Parser.new(content).to_html
15end
16
17markup(:creole, /creole/) do |content|
18  Creole.creolize(content)
19end
20
21markup(:wikicloth, /mediawiki|wiki/) do |content|
22  WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true)
23end
24
25markup(:literati, /lhs/) do |content|
26  Literati.render(content)
27end
28
29markup(:asciidoctor, /asc|adoc|asciidoc/) do |content|
30  Asciidoctor::Document.new(content).render
31end
32
33command(:rest2html, /re?st(\.txt)?/)
34
35# pod2html is nice enough to generate a full-on HTML document for us,
36# so we return the favor by ripping out the good parts.
37#
38# Any block passed to `command` will be handed the command's STDOUT for
39# post processing.
40command("/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go", /pod/) do |rendered|
41  if rendered =~ /<!-- start doc -->\s*(.+)\s*<!-- end doc -->/mi
42    $1
43  end
44end