Markdown Options for Jekyll

The various Markdown renderers supported by Jekyll sometimes have extra options available.

Kramdown

Kramdown is the default Markdown renderer for Jekyll. Below is a list of the currently supported options:

  • auto_id_prefix - Prefix used for automatically generated header IDs
    用于自动生成的标头ID的前缀

  • auto_id_stripping - Strip all formatting from header text for automatic ID generation
    从标题文本中剥离所有格式以自动生成ID

  • auto_ids - Use automatic header ID generation
    使用自动标题ID生成

  • coderay_bold_every - Defines how often a line number should be made bold

  • coderay_css - Defines how the highlighted code gets styled

  • coderay_default_lang - Sets the default language for highlighting code blocks

  • coderay_line_number_start - The start value for the line numbers

  • coderay_line_numbers - Defines how and if line numbers should be shown

  • coderay_tab_width - The tab width used in highlighted code

  • coderay_wrap - Defines how the highlighted code should be wrapped

  • enable_coderay - Use coderay for syntax highlighting

  • entity_output - Defines how entities are output

  • footnote_backlink - Defines the text that should be used for the footnote backlinks

  • footnote_backlink_inline - Specifies whether the footnote backlink should always be inline

  • footnote_nr - The number of the first footnote

  • gfm_quirks - Enables a set of GFM specific quirks

  • hard_wrap - Interprets line breaks literally

  • header_offset - Sets the output offset for headers

  • html_to_native - Convert HTML elements to native elements

  • line_width - Defines the line width to be used when outputting a document

  • link_defs - Pre-defines link definitions

  • math_engine - Set the math engine

  • math_engine_opts - Set the math engine options

  • parse_block_html - Process kramdown syntax in block HTML tags

  • parse_span_html - Process kramdown syntax in span HTML tags

  • smart_quotes - Defines the HTML entity names or code points for smart quote output

  • syntax_highlighter - Set the syntax highlighter

  • syntax_highlighter_opts - Set the syntax highlighter options

  • toc_levels - Defines the levels that are used for the table of contents

  • transliterated_header_ids - Transliterate the header text before generating the ID

  • typographic_symbols - Defines a mapping from typographical symbol to output characters

Example UsagePermalink

kramdown:
  html_to_native: true

There are two unsupported kramdown options
Please note that both remove_block_html_tags and remove_span_html_tags are currently unsupported in Jekyll due to >the fact that they are not included within the kramdown HTML converter.

For more details about these options have a look at the Kramdown configuration documentation.

CommonMarkPermalink

CommonMark is a rationalized version of Markdown syntax, implemented in C and thus faster than default Kramdown implemented in Ruby. It slightly differs from original Markdown and does not support all the syntax elements implemented in Kramdown, like Block Inline Attribute Lists.

It comes in two flavors: basic CommonMark with jekyll-commonmark plugin and GitHub Flavored Markdown supported by GitHub Pages.

Custom Markdown ProcessorsPermalink

If you’re interested in creating a custom markdown processor, you’re in luck! Create a new class in the Jekyll::Converters::Markdown namespace:

class Jekyll::Converters::Markdown::MyCustomProcessor
  def initialize(config)
    require 'funky_markdown'
    @config = config
  rescue LoadError
    STDERR.puts 'You are missing a library required for Markdown. Please run:'
    STDERR.puts '  $ [sudo] gem install funky_markdown'
    raise FatalException.new("Missing dependency: funky_markdown")
  end

  def convert(content)
    ::FunkyMarkdown.new(content).convert
  end
end

Once you’ve created your class and have it properly set up either as a plugin in the _plugins folder or as a gem, specify it in your _config.yml:

markdown: MyCustomProcessor

Reference

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值