Created
November 18, 2009 21:45
-
-
Save sidonath/238298 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'osax' | |
require 'maruku' | |
doc = Appscript.app('WriteRoom').documents[0] | |
path = doc.file.get.path | |
file = File.join( | |
File.dirname(path), | |
File.basename(path).gsub(File.extname(path), '.html')) | |
# add some style to a dull HTML | |
md = <<-MARKDOWN | |
CSS: ../main.css | |
MARKDOWN | |
# append the content and convert | |
md += doc.text_contents.get | |
m = Maruku.new(md) | |
# save and open HTML file in browser | |
File.open(file, 'w') { |f| f.write(m.to_html_document) } | |
exec "open #{file}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment