parent
452c1c88d0
commit
55dd39d580
|
@ -2,19 +2,37 @@
|
|||
|
||||
module Jekyll
|
||||
module Converters
|
||||
# Identify converter. Returns same content as given.
|
||||
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
||||
class Identity < Converter
|
||||
safe true
|
||||
|
||||
priority :lowest
|
||||
|
||||
# Public: Does the given extension match this converter's list of acceptable extensions?
|
||||
# Takes one argument: the file's extension (including the dot).
|
||||
#
|
||||
# ext - The String extension to check (not relevant here)
|
||||
#
|
||||
# Returns true since it always matches.
|
||||
def matches(_ext)
|
||||
true
|
||||
end
|
||||
|
||||
# Public: The extension to be given to the output file (including the dot).
|
||||
#
|
||||
# ext - The String extension or original file.
|
||||
#
|
||||
# Returns The String output file extension.
|
||||
def output_ext(ext)
|
||||
ext
|
||||
end
|
||||
|
||||
# Logic to do the content conversion.
|
||||
#
|
||||
# content - String content of file (without front matter).
|
||||
#
|
||||
# Returns a String of the converted content.
|
||||
def convert(content)
|
||||
content
|
||||
end
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
module Jekyll
|
||||
module Converters
|
||||
# Markdown converter.
|
||||
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
||||
class Markdown < Converter
|
||||
highlighter_prefix "\n"
|
||||
highlighter_suffix "\n"
|
||||
|
@ -61,14 +63,30 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
# Does the given extension match this converter's list of acceptable extensions?
|
||||
# Takes one argument: the file's extension (including the dot).
|
||||
#
|
||||
# ext - The String extension to check.
|
||||
#
|
||||
# Returns true if it matches, false otherwise.
|
||||
def matches(ext)
|
||||
extname_list.include?(ext.downcase)
|
||||
end
|
||||
|
||||
# Public: The extension to be given to the output file (including the dot).
|
||||
#
|
||||
# ext - The String extension or original file.
|
||||
#
|
||||
# Returns The String output file extension.
|
||||
def output_ext(_ext)
|
||||
".html"
|
||||
end
|
||||
|
||||
# Logic to do the content conversion.
|
||||
#
|
||||
# content - String content of file (without front matter).
|
||||
#
|
||||
# Returns a String of the converted content.
|
||||
def convert(content)
|
||||
setup
|
||||
@parser.convert(content)
|
||||
|
|
|
@ -19,6 +19,8 @@ end
|
|||
|
||||
module Jekyll
|
||||
module Converters
|
||||
# SmartyPants converter.
|
||||
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
||||
class SmartyPants < Converter
|
||||
safe true
|
||||
priority :low
|
||||
|
@ -29,14 +31,30 @@ module Jekyll
|
|||
@config[:input] = :SmartyPants
|
||||
end
|
||||
|
||||
# Does the given extension match this converter's list of acceptable extensions?
|
||||
# Takes one argument: the file's extension (including the dot).
|
||||
#
|
||||
# ext - The String extension to check.
|
||||
#
|
||||
# Returns true if it matches, false otherwise.
|
||||
def matches(_)
|
||||
false
|
||||
end
|
||||
|
||||
# Public: The extension to be given to the output file (including the dot).
|
||||
#
|
||||
# ext - The String extension or original file.
|
||||
#
|
||||
# Returns The String output file extension.
|
||||
def output_ext(_)
|
||||
nil
|
||||
end
|
||||
|
||||
# Logic to do the content conversion.
|
||||
#
|
||||
# content - String content of file (without front matter).
|
||||
#
|
||||
# Returns a String of the converted content.
|
||||
def convert(content)
|
||||
document = Kramdown::Document.new(content, @config)
|
||||
html_output = document.to_html.chomp
|
||||
|
|
Loading…
Reference in New Issue