BVB Source Codes

rouge Show redcarpet.rb Source code

Return Download rouge: download redcarpet.rb Source code - Download rouge Source code - Type:.rb
  1. # -*- coding: utf-8 -*- #
  2.  
  3. # this file is not require'd from the root.  To use this plugin, run:
  4. #
  5. #    require 'rouge/plugins/redcarpet'
  6.  
  7. module Rouge
  8.   module Plugins
  9.     module Redcarpet
  10.       def block_code(code, language)
  11.         lexer = Lexer.find_fancy(language, code) || Lexers::PlainText
  12.  
  13.         # XXX HACK: Redcarpet strips hard tabs out of code blocks,
  14.         # so we assume you're not using leading spaces that aren't tabs,
  15.         # and just replace them here.
  16.         if lexer.tag == 'make'
  17.           code.gsub! /^    /, "\t"
  18.         end
  19.  
  20.         formatter = rouge_formatter(lexer)
  21.         formatter.format(lexer.lex(code))
  22.       end
  23.  
  24.       # override this method for custom formatting behavior
  25.       def rouge_formatter(lexer)
  26.         Formatters::HTMLLegacy.new(:css_class => "highlight #{lexer.tag}")
  27.       end
  28.     end
  29.   end
  30. end
  31.  
downloadredcarpet.rb Source code - Download rouge Source code
Related Source Codes/Software:
spring-security-oauth - Support for adding OAuth1(a) and OAuth2 features (... 2017-04-23
Toucan - Fabulous Image Processing in Swift 2017-04-23
CoffeeScriptRedux - 2017-04-23
breakpoint - Really simple media queries in Sa 2017-04-23
libsvm - 2017-04-22
sphinx_rtd_theme - Sphinx theme for readthedocs.org 2017-04-23
BlurEffectForAndroidDesign - Sample to show how to implement blur graphical tri... 2017-04-23
mama2 - Mother plan - all firewood high flame 2017-04-23
JKeyboardPanelSwitch - For resolve the layout conflict when keybord & amp... 2017-04-23
viz.js - A hack to put Graphviz on the web. ... 2017-04-23
browser-diet - 2017-04-30
react-music - Make beats with React! http... 2017-04-30
java-code-styles - IntelliJ IDEA code style settings for Square's Jav... 2017-04-30
swing - A swipeable cards interface. The swipe-left/swipe-... 2017-04-30
qTip2 - qTip2 - Pretty powerful tooltips ... 2017-04-30
jo - JSON output from a shell 2017-04-30
Fluidbox - Replicating and improving the lightbox module seen... 2017-04-30
boto3 - AWS SDK for Python http://a... 2017-04-30
PreloadJS - PreloadJS makes preloading assets & getting ag... 2017-04-29
gotraining - Go Training Class Material : ... 2017-04-29

 Back to top