Sha256: b78009ffe12c0b01ddbc8dfc8225cad152814dfd098a9407a99c0b8e0b11d765
Contents?: true
Size: 659 Bytes
Versions: 11
Compression:
Stored size: 659 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' require 'redcarpet' class ShowMd TEMPFILE = "/tmp/markdown.html" def initialize( file ) @body = IO.read( file ) end def markdown options = [ :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode] File.open( TEMPFILE, "w" ) do |file| file.write( RedcarpetCompat.new( @body, *options).to_html ) end # do file end def show system("chromium-browser #{TEMPFILE} &") end end # class md = ShowMd.new( ARGV[0] ) md.markdown md.show # puts RedcarpetCompat.new(ARGF.read, # :fenced_code, # :hard_wrap, # :filter_html, # :smart).to_html
Version data entries
11 entries across 11 versions & 1 rubygems