all repos — markup @ 36ec73065f706fbd073126dcccb4b837be94ef9b

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

 1markup(:markdown, /md|mkdn?|mdown|markdown/) do |content|
 2  Markdown.new(content).to_html
 3end
 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
13command(:rest2html, /rest|rst/)
14
15command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
16
17# pod2html is nice enough to generate a full-on HTML document for us,
18# so we return the favor by ripping out the good parts.
19#
20# Any block passed to `command` will be handed the command's STDOUT for
21# post processing.
22command("/usr/bin/env pod2html", /pod/) do |rendered|
23  require 'fileutils'
24  if rendered =~ /<body.+?>\s*(.+)\s*<\/body>/mi
25    FileUtils.rm("pod2htmd.tmp") if File.exists?('pod2htmd.tmp') rescue nil
26    FileUtils.rm("pod2htmi.tmp") if File.exists?('pod2htmi.tmp') rescue nil
27    $1.sub('<!-- INDEX BEGIN -->', '').sub('<!-- INDEX END -->', '')
28  end
29end