Class: LlmDocsBuilder::Transformers::WhitespaceTransformer

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

Overview

Transformer for whitespace normalization

Reduces excessive blank lines and trailing whitespace to make content more compact for LLM consumption.

Instance Method Summary collapse

Methods included from BaseTransformer

#should_transform?

Instance Method Details

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

Transform content by normalizing whitespace

Parameters:

  • content (String)

    markdown content

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

    transformation options

Options Hash (options):

  • :normalize_whitespace (Boolean)

    enable normalization

Returns:

  • (String)

    transformed content



20
21
22
23
24
# File 'lib/llm_docs_builder/transformers/whitespace_transformer.rb', line 20

def transform(content, options = {})
  return content unless options[:normalize_whitespace]

  normalize_whitespace(content)
end