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.



640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/kreuzberg/config.rb', line 640

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.



638
639
640
# File 'lib/kreuzberg/config.rb', line 638

def options
  @options
end

Instance Method Details

#to_hObject



659
660
661
# File 'lib/kreuzberg/config.rb', line 659

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