all repos — markup @ dc4eb76fe9b862b3afbdbc9de4b3c3cffd10be58

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

 1markup(:markdown, /md|mkdn?|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(:asciidoc2html, /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  if rendered =~ /<!-- INDEX BEGIN -->\s*(.+)\s*<!-- INDEX END -->/mi
24    `rm pod2htmd.tmp` if File.exists?('pod2htmd.tmp') rescue nil
25    `rm pod2htmi.tmp` if File.exists?('pod2htmi.tmp') rescue nil
26    $1
27  end
28end