Class: Jekyll::Converters::Markdown
- Inherits:
-
Jekyll::Converter
- Object
- Plugin
- Jekyll::Converter
- Jekyll::Converters::Markdown
- Defined in:
- lib/jekyll/converters/markdown.rb,
lib/jekyll/converters/markdown/kramdown_parser.rb,
lib/jekyll/converters/markdown/rdiscount_parser.rb,
lib/jekyll/converters/markdown/redcarpet_parser.rb
Defined Under Namespace
Classes: KramdownParser, RDiscountParser, RedcarpetParser
Constant Summary
Constants inherited from Plugin
Instance Method Summary collapse
- #convert(content) ⇒ Object
- #extname_list ⇒ Object
- #get_processor ⇒ Object
- #matches(ext) ⇒ Object
- #output_ext(_ext) ⇒ Object
- #setup ⇒ Object
-
#third_party_processors ⇒ Object
Public: A list of processors that you provide via plugins.
-
#valid_processors ⇒ Object
Public: Provides you with a list of processors, the ones we support internally and the ones that you have provided to us (if you are not in safe mode.).
Methods inherited from Jekyll::Converter
highlighter_prefix, #highlighter_prefix, highlighter_suffix, #highlighter_suffix, #initialize
Methods inherited from Plugin
#<=>, <=>, catch_inheritance, descendants, inherited, #initialize, priority, safe
Constructor Details
This class inherits a constructor from Jekyll::Converter
Instance Method Details
#convert(content) ⇒ Object
63 64 65 66 |
# File 'lib/jekyll/converters/markdown.rb', line 63 def convert(content) setup @parser.convert(content) end |
#extname_list ⇒ Object
49 50 51 52 53 |
# File 'lib/jekyll/converters/markdown.rb', line 49 def extname_list @extname_list ||= @config['markdown_ext'].split(',').map do |e| ".#{e.downcase}" end end |
#get_processor ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/converters/markdown.rb', line 20 def get_processor case @config["markdown"].downcase when "redcarpet" then return RedcarpetParser.new(@config) when "kramdown" then return KramdownParser.new(@config) when "rdiscount" then return RDiscountParser.new(@config) else get_custom_processor end end |
#matches(ext) ⇒ Object
55 56 57 |
# File 'lib/jekyll/converters/markdown.rb', line 55 def matches(ext) extname_list.include?(ext.downcase) end |
#output_ext(_ext) ⇒ Object
59 60 61 |
# File 'lib/jekyll/converters/markdown.rb', line 59 def output_ext(_ext) ".html" end |
#setup ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jekyll/converters/markdown.rb', line 8 def setup return if @setup unless (@parser = get_processor) Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"] Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"] Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}" raise Errors::FatalException, "Bailing out; invalid Markdown processor." end @setup = true end |
#third_party_processors ⇒ Object
Public: A list of processors that you provide via plugins. This is really only available if you are not in safe mode, if you are in safe mode (re: GitHub) then there will be none.
42 43 44 45 46 47 |
# File 'lib/jekyll/converters/markdown.rb', line 42 def third_party_processors self.class.constants - \ %w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map( &:to_sym ) end |
#valid_processors ⇒ Object
Public: Provides you with a list of processors, the ones we support internally and the ones that you have provided to us (if you are not in safe mode.)
34 35 36 |
# File 'lib/jekyll/converters/markdown.rb', line 34 def valid_processors %W(rdiscount kramdown redcarpet) + third_party_processors end |