Skip to content

Instantly share code, notes, and snippets.

@jonahx
Created June 27, 2013 17:21
Show Gist options
  • Save jonahx/5878412 to your computer and use it in GitHub Desktop.
Save jonahx/5878412 to your computer and use it in GitHub Desktop.
A simple sinatra app that you can use with LiveReload to create a markdown previewer app. For example, to be used side by side with a vim window
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 %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment