Module: Commonmarker::Config

Extended by:
Utils
Defined in:
lib/commonmarker/config.rb

Constant Summary collapse

OPTIONS =
{
  parse: {
    smart: false,
    default_info_string: "",
  }.freeze,
  render: {
    hardbreaks: true,
    github_pre_lang: true,
    width: 80,
    unsafe: false,
    escape: false,
    sourcepos: false,
  }.freeze,
  extension: {
    strikethrough: true,
    tagfilter: true,
    table: true,
    autolink: true,
    tasklist: true,
    superscript: false,
    header_ids: "",
    footnotes: false,
    description_lists: false,
    front_matter_delimiter: "",
    shortcodes: true,
  },
  format: [:html].freeze,
}.freeze
PLUGINS =
{
  syntax_highlighter: {
    theme: "base16-ocean.dark",
    path: "",
  },
}

Constants included from Constants

Commonmarker::Constants::BOOLS

Class Method Summary collapse

Methods included from Utils

fetch_kv

Class Method Details

.merged_with_defaults(options) ⇒ Object



46
47
48
# File 'lib/commonmarker/config.rb', line 46

def merged_with_defaults(options)
  Commonmarker::Config::OPTIONS.merge(process_options(options))
end

.process_options(options) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/commonmarker/config.rb', line 50

def process_options(options)
  {
    parse: process_parse_options(options[:parse]),
    render: process_render_options(options[:render]),
    extension: process_extension_options(options[:extension]),
  }
end

.process_plugins(plugins) ⇒ Object



58
59
60
61
62
# File 'lib/commonmarker/config.rb', line 58

def process_plugins(plugins)
  {
    syntax_highlighter: process_syntax_highlighter_plugin(plugins&.fetch(:syntax_highlighter, nil)),
  }
end