Class: Jekyll::Converters::Markdown
- Inherits:
-
Jekyll::Converter
show all
- 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
Plugin::PRIORITIES
Instance Method Summary
collapse
highlighter_prefix, #highlighter_prefix, highlighter_suffix, #highlighter_suffix, #initialize
Methods inherited from Plugin
<=>, #<=>, descendants, #initialize, priority, safe
Instance Method Details
#convert(content) ⇒ Object
58
59
60
61
|
# File 'lib/jekyll/converters/markdown.rb', line 58
def convert(content)
setup
@parser.convert(content)
end
|
#extname_list ⇒ Object
46
47
48
|
# File 'lib/jekyll/converters/markdown.rb', line 46
def extname_list
@extname_list ||= @config['markdown_ext'].split(',').map { |e| ".#{e.downcase}" }
end
|
#matches(ext) ⇒ Object
50
51
52
|
# File 'lib/jekyll/converters/markdown.rb', line 50
def matches(ext)
extname_list.include? ext.downcase
end
|
#output_ext(ext) ⇒ Object
54
55
56
|
# File 'lib/jekyll/converters/markdown.rb', line 54
def output_ext(ext)
".html"
end
|
#setup ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/jekyll/converters/markdown.rb', line 9
def setup
return if @setup
@parser =
case @config['markdown'].downcase
when 'redcarpet' then RedcarpetParser.new(@config)
when 'kramdown' then KramdownParser.new(@config)
when 'rdiscount' then RDiscountParser.new(@config)
else
if allowed_custom_class?(@config['markdown'])
self.class.const_get(@config['markdown']).new(@config)
else
Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
Jekyll.logger.error "", "Valid options are [ #{valid_processors.join(" | ")} ]"
raise Errors::FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
end
end
@setup = true
end
|
#third_party_processors ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/jekyll/converters/markdown.rb', line 37
def third_party_processors
self.class.constants - %w[
KramdownParser
RDiscountParser
RedcarpetParser
PRIORITIES
].map(&:to_sym)
end
|
#valid_processors ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/jekyll/converters/markdown.rb', line 29
def valid_processors
%w[
rdiscount
kramdown
redcarpet
] + third_party_processors
end
|