Class: LlmDocsBuilder::Transformers::EnhancementTransformer

Inherits:
Object
  • Object
show all
Includes:
BaseTransformer
Defined in:
lib/llm_docs_builder/transformers/enhancement_transformer.rb

Overview

Transformer for document enhancements

Adds helpful features like table of contents and custom instructions to improve LLM navigation and context understanding.

Instance Method Summary collapse

Methods included from BaseTransformer

#should_transform?

Instance Method Details

#transform(content, options = {}) ⇒ String

Transform content by adding enhancements

Parameters:

  • content (String)

    markdown content

  • options (Hash) (defaults to: {})

    transformation options

Options Hash (options):

  • :generate_toc (Boolean)

    generate table of contents

  • :custom_instruction (String)

    custom instruction text

  • :remove_blockquotes (Boolean)

    whether blockquotes are being removed

Returns:

  • (String)

    transformed content



22
23
24
25
26
27
28
29
30
31
# File 'lib/llm_docs_builder/transformers/enhancement_transformer.rb', line 22

def transform(content, options = {})
  result = content.dup

  if options[:custom_instruction]
    result = inject_custom_instruction(result, options[:custom_instruction], options[:remove_blockquotes])
  end
  result = generate_table_of_contents(result) if options[:generate_toc]

  result
end