llms.txt Plug-in

This is a DITA-OT Plug-in which creates a set of output files suitable for use with LLMs (Large Language Models), following the llms.txt specification.

The transform is an extension of the existing DITA-OT markdown plug-in (org.lwdita) and creates the following:

  • A well-formatted llms.txt file containing the TOC of the map, automatically enriched with <shortdesc> elements.
  • A consolidated llms-full.txt containing the full concatenated markdown content of all the referenced topics in map order.

Example

# Project Name

> A brief description of the project and its purpose, containing key information necessary for understanding.

This section provides background information, guidance, or notes about the project and how to interpret the documentation.

## Docs

-   [abstract](topic0.md) - This is the short description for the abstract.
-   LLM Text
    -   [topic 1](topic1.md) - This is the short description for topic 1.
    -   [topic 2](topic2.md)
Figure 1. Sample llms.txt File

Install

This plug-in extends the standard org.lwdita plug-in which should be present in the base installation. It has no further external dependencies, and can be installed from the command line.

Run the plug-in installation commands:

dita install https://github.com/jason-fox/fox.jason.llms.txt/archive/master.zip

The dita command line tool requires no additional configuration.

Usage

Like any other transform, when invoked directly, the llms.txt transform requires an input document.

Creating llms.txt files from DITA content

To create the files for llms.txt, use the llms.txt transform and set the --input parameter to point to a *.ditamap file:

dita --format llms.txt \
    --input document.ditamap \
    --args.llms.template /sample/header.txt 

Parameter Reference

  • args.llms.txt.template - Specifies a template .txt file to prepend to the generated llms.txt file (typically contains the project header description).