Module: Scarlet::Highlighter
- Defined in:
- lib/scarlet/highlighter.rb
Class Method Summary collapse
Class Method Details
.run(text, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/scarlet/highlighter.rb', line 6 def self.run(text, ={}) [:format] ||= "html" [:lexer] ||= "text" [:arguments] ||= "" pid, stdin, stdout, stderr = Open4.popen4("pygmentize -f #{[:format]} -l #{[:lexer]} #{[:arguments]}") stdin.puts(text) stdin.close stdout.read.strip end |