Skip to content

Instantly share code, notes, and snippets.

@jonahx
Created June 27, 2013 17:21

Revisions

  1. jonahx created this gist Jun 27, 2013.
    27 changes: 27 additions & 0 deletions markdown_preview.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    require 'sinatra'
    require 'github/markdown'

    get '/' do
    @markdown_file = ENV['file']
    @markup = GitHub::Markdown.render_gfm(File.read(@markdown_file))
    erb :index
    end

    __END__

    @@ layout
    <html>
    <head>
    <title><%= @markdown_file %></title>
    <style>
    body {background: black; color: white; }
    </style>
    </head>

    <body>
    <%= yield %>
    </body>
    </html>

    @@ index
    <%= @markup %>