Module: LlmDocsBuilder
- Defined in:
- lib/llm_docs_builder.rb,
lib/llm_docs_builder/cli.rb,
lib/llm_docs_builder/config.rb,
lib/llm_docs_builder/errors.rb,
lib/llm_docs_builder/parser.rb,
lib/llm_docs_builder/helpers.rb,
lib/llm_docs_builder/version.rb,
lib/llm_docs_builder/generator.rb,
lib/llm_docs_builder/validator.rb,
lib/llm_docs_builder/comparator.rb,
lib/llm_docs_builder/url_fetcher.rb,
lib/llm_docs_builder/html_detector.rb,
lib/llm_docs_builder/text_compressor.rb,
lib/llm_docs_builder/token_estimator.rb,
lib/llm_docs_builder/bulk_transformer.rb,
lib/llm_docs_builder/output_formatter.rb,
lib/llm_docs_builder/markdown_transformer.rb,
lib/llm_docs_builder/html_to_markdown_converter.rb,
lib/llm_docs_builder/transformers/base_transformer.rb,
lib/llm_docs_builder/transformers/link_transformer.rb,
lib/llm_docs_builder/transformers/heading_transformer.rb,
lib/llm_docs_builder/transformers/whitespace_transformer.rb,
lib/llm_docs_builder/transformers/enhancement_transformer.rb,
lib/llm_docs_builder/html_to_markdown/table_markup_renderer.rb,
lib/llm_docs_builder/transformers/content_cleanup_transformer.rb,
lib/llm_docs_builder/helpers/squeeze_blank_lines_outside_fences.rb,
lib/llm_docs_builder/html_to_markdown/figure_code_block_renderer.rb,
lib/llm_docs_builder/helpers/prune_trailing_unsafe_link_separator.rb
Overview
Build and optimize documentation for LLMs
This gem provides tools for generating llms.txt files and transforming markdown documentation to be AI-friendly. It can reduce token consumption by 67-95% while preserving essential documentation content.
Defined Under Namespace
Modules: Errors, Helpers, HtmlToMarkdown, Transformers Classes: BulkTransformer, CLI, Comparator, Config, Generator, HtmlDetector, HtmlToMarkdownConverter, MarkdownTransformer, OutputFormatter, ParsedContent, Parser, TextCompressor, TokenEstimator, UrlFetcher, Validator
Constant Summary collapse
- VERSION =
Current version of the LlmDocsBuilder gem
'0.13.0'
Class Method Summary collapse
-
.bulk_transform(docs_path, options = {}) ⇒ Array<String>
Bulk transforms multiple markdown files to be AI-friendly.
-
.generate_from_docs(docs_path = nil, options = {}) ⇒ String
Generates llms.txt from existing markdown documentation.
-
.parse(file_path) ⇒ Parser
Parses an existing llms.txt file.
-
.transform_markdown(file_path, options = {}) ⇒ String
Transforms a markdown file to be AI-friendly.
-
.validate(content) ⇒ Boolean
Validates llms.txt content.
Class Method Details
.bulk_transform(docs_path, options = {}) ⇒ Array<String>
Bulk transforms multiple markdown files to be AI-friendly
118 119 120 121 122 123 |
# File 'lib/llm_docs_builder.rb', line 118 def bulk_transform(docs_path, = {}) config = Config.new([:config_file]) = config.() BulkTransformer.new(docs_path, ).transform_all end |
.generate_from_docs(docs_path = nil, options = {}) ⇒ String
Generates llms.txt from existing markdown documentation
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/llm_docs_builder.rb', line 52 def generate_from_docs(docs_path = nil, = {}) # Support config-first usage: generate_from_docs(config_file: 'path.yml') if docs_path.is_a?(Hash) && docs_path.key?(:config_file) = docs_path docs_path = nil end config = Config.new([:config_file]) = config.() # Use docs_path param or config file docs setting final_docs_path = docs_path || [:docs] Generator.new(final_docs_path, ).generate end |
.parse(file_path) ⇒ Parser
Parses an existing llms.txt file
129 130 131 |
# File 'lib/llm_docs_builder.rb', line 129 def parse(file_path) Parser.new(file_path).parse end |
.transform_markdown(file_path, options = {}) ⇒ String
Transforms a markdown file to be AI-friendly
87 88 89 90 91 92 |
# File 'lib/llm_docs_builder.rb', line 87 def transform_markdown(file_path, = {}) config = Config.new([:config_file]) = config.() MarkdownTransformer.new(file_path, ).transform end |