Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Sep 24th, 2018 52 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #!/usr/bin/env ruby
  2.  
  3. require 'rubygems'
  4. require 'redcarpet'
  5. require 'Pygments'
  6.  
  7. class HTMLwithPygments < Redcarpet::Render::XHTML
  8.   # def doc_header()
  9.   # puts Pygments.styles()
  10.   # monokai
  11.   # manni
  12.   # perldoc
  13.   # borland
  14.   # colorful
  15.   # default
  16.   # murphy
  17.   # vs
  18.   # trac
  19.   # tango
  20.   # fruity
  21.   # autumn
  22.   # bw
  23.   # emacs
  24.   # vim
  25.   # pastie
  26.   # friendly
  27.   # native
  28.   #   '<style>' + Pygments.css('.highlight',:style => 'vs') + '</style>'
  29.   # end
  30.   def block_code(code, language)
  31.     Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'})
  32.   end
  33. end
  34.  
  35.  
  36. def fromMarkdown(text)
  37.   # options = [:fenced_code => true, :generate_toc => true, :hard_wrap => true, :no_intraemphasis => true, :strikethrough => true ,:gh_blockcode => true, :autolink => true, :xhtml => true, :tables => true]
  38.   markdown = Redcarpet::Markdown.new(HTMLwithPygments,
  39.                                      :fenced_code_blocks => true,
  40.                                      :no_intra_emphasis => true,
  41.                                      :autolink => true,
  42.                                      :strikethrough => true,
  43.                                      :lax_html_blocks => true,
  44.                                      :superscript => true,
  45.                                      :hard_wrap => true,
  46.                                      :tables => true,
  47.                                      :xhtml => true)
  48.   markdown.render(text)
  49. end
  50.  
  51. puts fromMarkdown(ARGF.read)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top