jekyllplusadmin 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +80 -0
- data/LICENSE +21 -0
- data/README.markdown +60 -0
- data/bin/jekyll +51 -0
- data/lib/jekyll.rb +180 -0
- data/lib/jekyll/cleaner.rb +105 -0
- data/lib/jekyll/collection.rb +205 -0
- data/lib/jekyll/command.rb +65 -0
- data/lib/jekyll/commands/build.rb +77 -0
- data/lib/jekyll/commands/clean.rb +42 -0
- data/lib/jekyll/commands/doctor.rb +114 -0
- data/lib/jekyll/commands/help.rb +31 -0
- data/lib/jekyll/commands/new.rb +82 -0
- data/lib/jekyll/commands/serve.rb +235 -0
- data/lib/jekyll/commands/serve/servlet.rb +61 -0
- data/lib/jekyll/configuration.rb +323 -0
- data/lib/jekyll/converter.rb +48 -0
- data/lib/jekyll/converters/identity.rb +21 -0
- data/lib/jekyll/converters/markdown.rb +92 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +117 -0
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +33 -0
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +102 -0
- data/lib/jekyll/converters/smartypants.rb +34 -0
- data/lib/jekyll/convertible.rb +297 -0
- data/lib/jekyll/deprecator.rb +46 -0
- data/lib/jekyll/document.rb +444 -0
- data/lib/jekyll/drops/collection_drop.rb +22 -0
- data/lib/jekyll/drops/document_drop.rb +27 -0
- data/lib/jekyll/drops/drop.rb +176 -0
- data/lib/jekyll/drops/jekyll_drop.rb +21 -0
- data/lib/jekyll/drops/site_drop.rb +38 -0
- data/lib/jekyll/drops/unified_payload_drop.rb +25 -0
- data/lib/jekyll/drops/url_drop.rb +83 -0
- data/lib/jekyll/entry_filter.rb +72 -0
- data/lib/jekyll/errors.rb +10 -0
- data/lib/jekyll/excerpt.rb +127 -0
- data/lib/jekyll/external.rb +59 -0
- data/lib/jekyll/filters.rb +367 -0
- data/lib/jekyll/frontmatter_defaults.rb +188 -0
- data/lib/jekyll/generator.rb +3 -0
- data/lib/jekyll/hooks.rb +101 -0
- data/lib/jekyll/layout.rb +49 -0
- data/lib/jekyll/liquid_extensions.rb +22 -0
- data/lib/jekyll/liquid_renderer.rb +39 -0
- data/lib/jekyll/liquid_renderer/file.rb +50 -0
- data/lib/jekyll/liquid_renderer/table.rb +94 -0
- data/lib/jekyll/log_adapter.rb +115 -0
- data/lib/jekyll/mime.types +800 -0
- data/lib/jekyll/page.rb +180 -0
- data/lib/jekyll/plugin.rb +96 -0
- data/lib/jekyll/plugin_manager.rb +95 -0
- data/lib/jekyll/publisher.rb +21 -0
- data/lib/jekyll/reader.rb +126 -0
- data/lib/jekyll/readers/collection_reader.rb +20 -0
- data/lib/jekyll/readers/data_reader.rb +69 -0
- data/lib/jekyll/readers/layout_reader.rb +53 -0
- data/lib/jekyll/readers/page_reader.rb +21 -0
- data/lib/jekyll/readers/post_reader.rb +62 -0
- data/lib/jekyll/readers/static_file_reader.rb +21 -0
- data/lib/jekyll/regenerator.rb +175 -0
- data/lib/jekyll/related_posts.rb +56 -0
- data/lib/jekyll/renderer.rb +191 -0
- data/lib/jekyll/site.rb +391 -0
- data/lib/jekyll/static_file.rb +141 -0
- data/lib/jekyll/stevenson.rb +58 -0
- data/lib/jekyll/tags/highlight.rb +122 -0
- data/lib/jekyll/tags/include.rb +190 -0
- data/lib/jekyll/tags/post_url.rb +88 -0
- data/lib/jekyll/url.rb +136 -0
- data/lib/jekyll/utils.rb +287 -0
- data/lib/jekyll/utils/ansi.rb +59 -0
- data/lib/jekyll/utils/platforms.rb +30 -0
- data/lib/jekyll/version.rb +3 -0
- data/lib/site_template/.gitignore +3 -0
- data/lib/site_template/_config.yml +21 -0
- data/lib/site_template/_includes/footer.html +38 -0
- data/lib/site_template/_includes/head.html +12 -0
- data/lib/site_template/_includes/header.html +27 -0
- data/lib/site_template/_includes/icon-github.html +1 -0
- data/lib/site_template/_includes/icon-github.svg +1 -0
- data/lib/site_template/_includes/icon-twitter.html +1 -0
- data/lib/site_template/_includes/icon-twitter.svg +1 -0
- data/lib/site_template/_layouts/default.html +20 -0
- data/lib/site_template/_layouts/page.html +14 -0
- data/lib/site_template/_layouts/post.html +15 -0
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +25 -0
- data/lib/site_template/_sass/_base.scss +206 -0
- data/lib/site_template/_sass/_layout.scss +242 -0
- data/lib/site_template/_sass/_syntax-highlighting.scss +71 -0
- data/lib/site_template/about.md +15 -0
- data/lib/site_template/css/main.scss +53 -0
- data/lib/site_template/feed.xml +30 -0
- data/lib/site_template/index.html +23 -0
- metadata +252 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
class Converter < Plugin
|
|
3
|
+
# Public: Get or set the highlighter prefix. When an argument is specified,
|
|
4
|
+
# the prefix will be set. If no argument is specified, the current prefix
|
|
5
|
+
# will be returned.
|
|
6
|
+
#
|
|
7
|
+
# highlighter_prefix - The String prefix (default: nil).
|
|
8
|
+
#
|
|
9
|
+
# Returns the String prefix.
|
|
10
|
+
def self.highlighter_prefix(highlighter_prefix = nil)
|
|
11
|
+
@highlighter_prefix = highlighter_prefix if highlighter_prefix
|
|
12
|
+
@highlighter_prefix
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Public: Get or set the highlighter suffix. When an argument is specified,
|
|
16
|
+
# the suffix will be set. If no argument is specified, the current suffix
|
|
17
|
+
# will be returned.
|
|
18
|
+
#
|
|
19
|
+
# highlighter_suffix - The String suffix (default: nil).
|
|
20
|
+
#
|
|
21
|
+
# Returns the String suffix.
|
|
22
|
+
def self.highlighter_suffix(highlighter_suffix = nil)
|
|
23
|
+
@highlighter_suffix = highlighter_suffix if highlighter_suffix
|
|
24
|
+
@highlighter_suffix
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Initialize the converter.
|
|
28
|
+
#
|
|
29
|
+
# Returns an initialized Converter.
|
|
30
|
+
def initialize(config = {})
|
|
31
|
+
@config = config
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Get the highlighter prefix.
|
|
35
|
+
#
|
|
36
|
+
# Returns the String prefix.
|
|
37
|
+
def highlighter_prefix
|
|
38
|
+
self.class.highlighter_prefix
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Get the highlighter suffix.
|
|
42
|
+
#
|
|
43
|
+
# Returns the String suffix.
|
|
44
|
+
def highlighter_suffix
|
|
45
|
+
self.class.highlighter_suffix
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
module Converters
|
|
3
|
+
class Markdown < Converter
|
|
4
|
+
highlighter_prefix "\n"
|
|
5
|
+
highlighter_suffix "\n"
|
|
6
|
+
safe true
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
return if @setup
|
|
10
|
+
unless (@parser = get_processor)
|
|
11
|
+
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
|
|
12
|
+
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
|
|
13
|
+
Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
|
|
14
|
+
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@setup = true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get_processor
|
|
21
|
+
case @config["markdown"].downcase
|
|
22
|
+
when "redcarpet" then return RedcarpetParser.new(@config)
|
|
23
|
+
when "kramdown" then return KramdownParser.new(@config)
|
|
24
|
+
when "rdiscount" then return RDiscountParser.new(@config)
|
|
25
|
+
else
|
|
26
|
+
get_custom_processor
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Public: Provides you with a list of processors, the ones we
|
|
31
|
+
# support internally and the ones that you have provided to us (if you
|
|
32
|
+
# are not in safe mode.)
|
|
33
|
+
|
|
34
|
+
def valid_processors
|
|
35
|
+
%W(rdiscount kramdown redcarpet) + third_party_processors
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Public: A list of processors that you provide via plugins.
|
|
39
|
+
# This is really only available if you are not in safe mode, if you are
|
|
40
|
+
# in safe mode (re: GitHub) then there will be none.
|
|
41
|
+
|
|
42
|
+
def third_party_processors
|
|
43
|
+
self.class.constants - \
|
|
44
|
+
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
|
|
45
|
+
&:to_sym
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def extname_list
|
|
50
|
+
@extname_list ||= @config['markdown_ext'].split(',').map do |e|
|
|
51
|
+
".#{e.downcase}"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def matches(ext)
|
|
56
|
+
extname_list.include?(ext.downcase)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def output_ext(_ext)
|
|
60
|
+
".html"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def convert(content)
|
|
64
|
+
setup
|
|
65
|
+
@parser.convert(content)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
def get_custom_processor
|
|
70
|
+
converter_name = @config["markdown"]
|
|
71
|
+
if custom_class_allowed?(converter_name)
|
|
72
|
+
self.class.const_get(converter_name).new(@config)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Private: Determine whether a class name is an allowed custom
|
|
77
|
+
# markdown class name.
|
|
78
|
+
#
|
|
79
|
+
# parser_name - the name of the parser class
|
|
80
|
+
#
|
|
81
|
+
# Returns true if the parser name contains only alphanumeric
|
|
82
|
+
# characters and is defined within Jekyll::Converters::Markdown
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
def custom_class_allowed?(parser_name)
|
|
86
|
+
parser_name !~ /[^A-Za-z0-9_]/ && self.class.constants.include?(
|
|
87
|
+
parser_name.to_sym
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Frozen-string-literal: true
|
|
2
|
+
# Encoding: utf-8
|
|
3
|
+
|
|
4
|
+
module Jekyll
|
|
5
|
+
module Converters
|
|
6
|
+
class Markdown
|
|
7
|
+
class KramdownParser
|
|
8
|
+
CODERAY_DEFAULTS = {
|
|
9
|
+
"css" => "style",
|
|
10
|
+
"bold_every" => 10,
|
|
11
|
+
"line_numbers" => "inline",
|
|
12
|
+
"line_number_start" => 1,
|
|
13
|
+
"tab_width" => 4,
|
|
14
|
+
"wrap" => "div"
|
|
15
|
+
}.freeze
|
|
16
|
+
|
|
17
|
+
def initialize(config)
|
|
18
|
+
Jekyll::External.require_with_graceful_fail "kramdown"
|
|
19
|
+
@main_fallback_highlighter = config["highlighter"] || "rouge"
|
|
20
|
+
@config = config["kramdown"] || {}
|
|
21
|
+
setup
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Setup and normalize the configuration:
|
|
25
|
+
# * Create Kramdown if it doesn't exist.
|
|
26
|
+
# * Set syntax_highlighter, detecting enable_coderay and merging highlighter if none.
|
|
27
|
+
# * Merge kramdown[coderay] into syntax_highlighter_opts stripping coderay_.
|
|
28
|
+
# * Make sure `syntax_highlighter_opts` exists.
|
|
29
|
+
|
|
30
|
+
def setup
|
|
31
|
+
@config["syntax_highlighter"] ||= highlighter
|
|
32
|
+
@config["syntax_highlighter_opts"] ||= {}
|
|
33
|
+
@config["coderay"] ||= {} # XXX: Legacy.
|
|
34
|
+
modernize_coderay_config
|
|
35
|
+
make_accessible
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def convert(content)
|
|
39
|
+
Kramdown::Document.new(content, @config).to_html
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
def make_accessible(hash = @config)
|
|
44
|
+
proc_ = proc { |hash_, key| hash_[key.to_s] if key.is_a?(Symbol) }
|
|
45
|
+
hash.default_proc = proc_
|
|
46
|
+
|
|
47
|
+
hash.each do |_, val|
|
|
48
|
+
make_accessible val if val.is_a?(
|
|
49
|
+
Hash
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# config[kramdown][syntax_higlighter] > config[kramdown][enable_coderay] > config[highlighter]
|
|
55
|
+
# Where `enable_coderay` is now deprecated because Kramdown
|
|
56
|
+
# supports Rouge now too.
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
def highlighter
|
|
60
|
+
return @highlighter if @highlighter
|
|
61
|
+
|
|
62
|
+
if @config["syntax_highlighter"]
|
|
63
|
+
return @highlighter = @config[
|
|
64
|
+
"syntax_highlighter"
|
|
65
|
+
]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
@highlighter = begin
|
|
69
|
+
if @config.key?("enable_coderay") && @config["enable_coderay"]
|
|
70
|
+
Jekyll::Deprecator.deprecation_message "You are using 'enable_coderay', " \
|
|
71
|
+
"use syntax_highlighter: coderay in your configuration file."
|
|
72
|
+
|
|
73
|
+
"coderay"
|
|
74
|
+
else
|
|
75
|
+
@main_fallback_highlighter
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
private
|
|
81
|
+
def strip_coderay_prefix(hash)
|
|
82
|
+
hash.each_with_object({}) do |(key, val), hsh|
|
|
83
|
+
cleaned_key = key.gsub(/\Acoderay_/, "")
|
|
84
|
+
|
|
85
|
+
if key != cleaned_key
|
|
86
|
+
Jekyll::Deprecator.deprecation_message(
|
|
87
|
+
"You are using '#{key}'. Normalizing to #{cleaned_key}."
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
hsh[cleaned_key] = val
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# If our highlighter is CodeRay we go in to merge the CodeRay defaults
|
|
96
|
+
# with your "coderay" key if it's there, deprecating it in the
|
|
97
|
+
# process of you using it.
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
def modernize_coderay_config
|
|
101
|
+
if highlighter == "coderay"
|
|
102
|
+
Jekyll::Deprecator.deprecation_message "You are using 'kramdown.coderay' in your configuration, " \
|
|
103
|
+
"please use 'syntax_highlighter_opts' instead."
|
|
104
|
+
|
|
105
|
+
@config["syntax_highlighter_opts"] = begin
|
|
106
|
+
strip_coderay_prefix(
|
|
107
|
+
@config["syntax_highlighter_opts"] \
|
|
108
|
+
.merge(CODERAY_DEFAULTS) \
|
|
109
|
+
.merge(@config["coderay"])
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
module Converters
|
|
3
|
+
class Markdown
|
|
4
|
+
class RDiscountParser
|
|
5
|
+
def initialize(config)
|
|
6
|
+
Jekyll::External.require_with_graceful_fail "rdiscount"
|
|
7
|
+
@config = config
|
|
8
|
+
@rdiscount_extensions = @config['rdiscount']['extensions'].map(&:to_sym)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def convert(content)
|
|
12
|
+
rd = RDiscount.new(content, *@rdiscount_extensions)
|
|
13
|
+
html = rd.to_html
|
|
14
|
+
if @config['rdiscount']['toc_token']
|
|
15
|
+
html = replace_generated_toc(rd, html, @config['rdiscount']['toc_token'])
|
|
16
|
+
end
|
|
17
|
+
html
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
def replace_generated_toc(rd, html, toc_token)
|
|
22
|
+
if rd.generate_toc && html.include?(toc_token)
|
|
23
|
+
utf8_toc = rd.toc_content
|
|
24
|
+
utf8_toc.force_encoding('utf-8') if utf8_toc.respond_to?(:force_encoding)
|
|
25
|
+
html.gsub(toc_token, utf8_toc)
|
|
26
|
+
else
|
|
27
|
+
html
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
module Converters
|
|
3
|
+
class Markdown
|
|
4
|
+
class RedcarpetParser
|
|
5
|
+
module CommonMethods
|
|
6
|
+
def add_code_tags(code, lang)
|
|
7
|
+
code = code.to_s
|
|
8
|
+
code = code.sub(/<pre>/, "<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">")
|
|
9
|
+
code = code.sub(/<\/pre>/, "</code></pre>")
|
|
10
|
+
code
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
module WithPygments
|
|
15
|
+
include CommonMethods
|
|
16
|
+
def block_code(code, lang)
|
|
17
|
+
Jekyll::External.require_with_graceful_fail("pygments")
|
|
18
|
+
lang = lang && lang.split.first || "text"
|
|
19
|
+
add_code_tags(
|
|
20
|
+
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
|
|
21
|
+
lang
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module WithoutHighlighting
|
|
27
|
+
require 'cgi'
|
|
28
|
+
|
|
29
|
+
include CommonMethods
|
|
30
|
+
|
|
31
|
+
def code_wrap(code)
|
|
32
|
+
"<figure class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></figure>"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def block_code(code, lang)
|
|
36
|
+
lang = lang && lang.split.first || "text"
|
|
37
|
+
add_code_tags(code_wrap(code), lang)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
module WithRouge
|
|
42
|
+
def block_code(code, lang)
|
|
43
|
+
code = "<pre>#{super}</pre>"
|
|
44
|
+
|
|
45
|
+
output = "<div class=\"highlight\">"
|
|
46
|
+
output << add_code_tags(code, lang)
|
|
47
|
+
output << "</div>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
protected
|
|
51
|
+
def rouge_formatter(_lexer)
|
|
52
|
+
Rouge::Formatters::HTML.new(:wrap => false)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(config)
|
|
57
|
+
External.require_with_graceful_fail("redcarpet")
|
|
58
|
+
@config = config
|
|
59
|
+
@redcarpet_extensions = {}
|
|
60
|
+
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
|
|
61
|
+
|
|
62
|
+
@renderer ||= class_with_proper_highlighter(@config['highlighter'])
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def class_with_proper_highlighter(highlighter)
|
|
66
|
+
case highlighter
|
|
67
|
+
when "pygments"
|
|
68
|
+
Class.new(Redcarpet::Render::HTML) do
|
|
69
|
+
include WithPygments
|
|
70
|
+
end
|
|
71
|
+
when "rouge"
|
|
72
|
+
Class.new(Redcarpet::Render::HTML) do
|
|
73
|
+
Jekyll::External.require_with_graceful_fail(%w(
|
|
74
|
+
rouge
|
|
75
|
+
rouge/plugins/redcarpet
|
|
76
|
+
))
|
|
77
|
+
|
|
78
|
+
unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
|
|
79
|
+
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
include Rouge::Plugins::Redcarpet
|
|
83
|
+
include CommonMethods
|
|
84
|
+
include WithRouge
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
Class.new(Redcarpet::Render::HTML) do
|
|
88
|
+
include WithoutHighlighting
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def convert(content)
|
|
94
|
+
@redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
|
|
95
|
+
@renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
|
|
96
|
+
markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
|
|
97
|
+
markdown.render(content)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
|
|
2
|
+
def initialize(source, options)
|
|
3
|
+
super
|
|
4
|
+
@block_parsers = [:block_html]
|
|
5
|
+
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module Jekyll
|
|
10
|
+
module Converters
|
|
11
|
+
class SmartyPants < Converter
|
|
12
|
+
safe true
|
|
13
|
+
priority :low
|
|
14
|
+
|
|
15
|
+
def initialize(config)
|
|
16
|
+
Jekyll::External.require_with_graceful_fail "kramdown"
|
|
17
|
+
@config = config["kramdown"].dup || {}
|
|
18
|
+
@config[:input] = :SmartyPants
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def matches(_)
|
|
22
|
+
false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def output_ext(_)
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def convert(content)
|
|
30
|
+
Kramdown::Document.new(content, @config).to_html.chomp
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|