Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.