Created
June 27, 2013 17:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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