Class: Kreuzberg::Config::HtmlOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/kreuzberg/config.rb

Overview

HTML rendering options for document conversion

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ HtmlOptions

Returns a new instance of HtmlOptions.



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/kreuzberg/config.rb', line 626

def initialize(**options)
  normalized = options.transform_keys(&:to_sym)
  symbol_keys = %i[
    heading_style
    code_block_style
    highlight_style
    list_indent_type
    newline_style
    whitespace_mode
  ]
  symbol_keys.each do |key|
    normalized[key] = normalized[key]&.to_sym if normalized.key?(key)
  end
  if normalized[:preprocessing].is_a?(Hash)
    normalized[:preprocessing] = HtmlPreprocessing.new(**normalized[:preprocessing])
  end
  @options = normalized
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



624
625
626
# File 'lib/kreuzberg/config.rb', line 624

def options
  @options
end

Instance Method Details

#to_hObject



645
646
647
# File 'lib/kreuzberg/config.rb', line 645

def to_h
  @options.transform_values { |value| value.respond_to?(:to_h) ? value.to_h : value }
end