Skip to content

[Repo Assist] Add llms.txt/llms-full.txt generation#980

Open
github-actions[bot] wants to merge 17 commits intomainfrom
repo-assist/feature-llmstxt-951-9e151877ea004bb1
Open

[Repo Assist] Add llms.txt/llms-full.txt generation#980
github-actions[bot] wants to merge 17 commits intomainfrom
repo-assist/feature-llmstxt-951-9e151877ea004bb1

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Feb 22, 2026

🤖 This is an automated PR from Repo Assist, an AI assistant for this repository.

Closes #951

Summary

Adds a --generatellmstxt flag to fsdocs build and fsdocs watch. When enabled, two files are written to the output root:

  • llms.txt — a Markdown index with links to all documentation pages and API reference entries, following the [llmstxt.org]((llmstxt.org/redacted) convention
  • llms-full.txt — same as above but with full page content included after each entry

This makes it easy to add documentation context for F# projects to LLMs and AI coding assistants.

Usage

dotnet fsdocs build --generatellmstxt
```

## Implementation

The generated files reuse the search index data (`latestApiDocSearchIndexEntries` and `latestDocContentSearchIndexEntries`) that is already in memory, so there's no additional parsing overhead. The files are regenerated whenever the search index is regenerated (on initial build and on file changes in watch mode).

The format is:

```
# {collection-name}

## Docs

- [Page title]((example.com/redacted)
...

## API Reference

- [Namespace.Type]((example.com/redacted)
...

Trade-offs

  • Uses existing in-memory data; no new dependencies.
  • llms-full.txt can be large for projects with extensive API docs. Users can choose which file to expose.
  • Watch mode regenerates both files on every content or project change, which is appropriate for iterative editing.

Test Status

  • dotnet build src/fsdocs-tool/fsdocs-tool.fsproj -c Release — succeeded, 0 errors
  • dotnet test tests/FSharp.ApiDocs.Tests/FSharp.ApiDocs.Tests.fsproj -c Release — 68 passed, 0 failed

Generated by Repo Assist

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@ee50a3b7d1d3eb4a8c409ac9409fd61c9a66b0f5. View source at https://github.com/githubnext/agentics/tree/ee50a3b7d1d3eb4a8c409ac9409fd61c9a66b0f5/workflows/repo-assist.md.

Implements support for generating llms.txt and llms-full.txt files
alongside the documentation output when --generatellmstxt is passed
to fsdocs build or fsdocs watch.

- llms.txt: title/link index of all docs and API reference entries
- llms-full.txt: same with full page content included

Files follow the llmstxt.org convention, making project documentation
easily consumable by LLMs and AI coding assistants.

Closes #951

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

✅ Pull request created: #980

@dsyme
Copy link
Contributor

dsyme commented Feb 23, 2026

/repo-assist change the flag in this PR to --llms

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

✅ Commit pushed: 468ac35

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Done! Renamed --generatellmstxt to --llms in both the code (BuildCommand.fs) and RELEASE_NOTES.md.

Generated by Repo Assist for issue #980

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/repo-assist.md.

@dsyme dsyme closed this Feb 23, 2026
@dsyme dsyme reopened this Feb 23, 2026
@dsyme
Copy link
Contributor

dsyme commented Feb 23, 2026

/repo-assist We need some kind of testing added for this

Extract llms.txt generation logic into LlmsTxt module and add
8 unit tests covering: header generation, empty entries, Docs/API
Reference section separation, index-only vs full-content modes,
blank content skipping, and conditional section omission.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

✅ Commit pushed: a8c94e0

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Done! Added testing for the --llms flag. Here's what was changed:

src/fsdocs-tool/BuildCommand.fs
Extracted the core text-generation logic from the private generateLlmsTxt local function into a new internal module LlmsTxt with two public functions:

  • LlmsTxt.buildSection — builds one markdown section (Docs or API Reference)
  • LlmsTxt.buildContent — takes collectionName + all search index entries, returns (llms.txt content, llms-full.txt content)

The generateLlmsTxt call site is simplified to just call LlmsTxt.buildContent and write the results.

tests/FSharp.Literate.Tests/DocContentTests.fs
Added 8 unit tests for LlmsTxt.buildContent:

  1. Correct header is generated
  2. Empty entries → header only
  3. Docs and API Reference sections are separated correctly
  4. llms.txt (index mode) does not include content body
  5. llms-full.txt includes content body
  6. Blank content is skipped in full mode
  7. ## Docs section is omitted when no content entries exist
  8. ## API Reference section is omitted when no apiDocs entries exist

All 8 tests pass (dotnet test --filter "FullyQualifiedName~LlmsTxt" → 8/8 passed).

Generated by Repo Assist for issue #980

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/repo-assist.md.

[<Option("clean", Required = false, Default = false, HelpText = "Clean the output directory.")>]
member val clean = false with get, set

[<Option("llms",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to have this as fsproj/msbuild configuration rather than a new feature flag.

Copy link
Collaborator

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to pass --llm on everything invocation doesn't seem the way to go for me.
I'd rather enable this once and then never forget about it.

@dsyme
Copy link
Contributor

dsyme commented Feb 23, 2026

Having to pass --llm on everything invocation doesn't seem the way to go for me. I'd rather enable this once and then never forget about it.

Yup agreed. It's possible it should be on by default too? Gven use of LLMs is now normal.

@dsyme dsyme marked this pull request as ready for review February 23, 2026 11:24
@nojaf
Copy link
Collaborator

nojaf commented Feb 23, 2026

It's possible it should be on by default too?

Seems like a reasonable default yes.

@dsyme
Copy link
Contributor

dsyme commented Feb 23, 2026

/repo-assist update this PR taking this into account:

I think it makes more sense to have this as fsproj/msbuild configuration rather than a new feature flag.

Please make sure all docs are updated.

…enabled by default)

Instead of requiring users to pass --llms on every fsdocs build/watch
invocation, read the new <FsDocsGenerateLlmsTxt> MSBuild property from
the project file or Directory.Build.props. The property defaults to true,
so llms.txt and llms-full.txt are generated automatically. Projects that
want to opt out can set <FsDocsGenerateLlmsTxt>false</FsDocsGenerateLlmsTxt>.

Closes #951

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

✅ Commit pushed: 761d83b

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Done! Replaced the --llms CLI flag with a (FsDocsGenerateLlmsTxt) MSBuild property.

What changed:

  • src/fsdocs-tool/ProjectCracker.fs — Added FsDocsGenerateLlmsTxt to CrackedProjectInfo. Reads from the project file (default: true) and is propagated through crackProjects.
  • src/fsdocs-tool/BuildCommand.fs — Removed the --llms CLI option. The generateLlmsTxt function now checks the MSBuild property value instead.
  • docs/styling.md — New "LLM-Friendly Output" section documenting the property and how to opt out.
  • RELEASE_NOTES.md — Updated entry to reflect the new configuration approach.

Behaviour:

Scenario Result
Default (no property set) llms.txt and llms-full.txt are generated ✅
(FsDocsGenerateLlmsTxt)true(/FsDocsGenerateLlmsTxt) Generated ✅
(FsDocsGenerateLlmsTxt)false(/FsDocsGenerateLlmsTxt) Not generated ❌

The property can be set in the project file (.fsproj) or in Directory.Build.props for repo-wide control. All 8 existing LlmsTxt unit tests still pass.

Generated by Repo Assist for issue #980

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/repo-assist.md.

@dsyme
Copy link
Contributor

dsyme commented Feb 23, 2026

/repo-assist Make the default for the MSBuild property for llms text to be on by default please and adjust test and documentation for this. Update release notes

@dsyme dsyme changed the title [Repo Assist] Add --generatellmstxt flag for llms.txt/llms-full.txt generation [Repo Assist] Add llms.txt/llms-full.txt generation Feb 23, 2026
… (on by default)

The LlmsTxt tests were added when this was a CLI flag. Update the section
comment to accurately describe the current implementation as an MSBuild
property that is enabled by default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nojaf
Copy link
Collaborator

nojaf commented Feb 23, 2026

/repo-assist

I'm still not entirely happy with the output here.

Example llms-full.txt output:

# fantomas

## Docs

### [Fantomas
](https://fsprojects.github.io/fantomas/docs/index.html)

Fantomas


F# source code formatter, inspired by scalariform for Scala, ocp-indent for OCaml and PythonTidy for Python.
Purpose
This project aims at formatting F# source files based on a given configuration.
Fantomas will ensure correct indentation and consistent spacing between elements in the source files.
We assume that the source files are parsable by F# compiler before feeding into the tool.
Fantomas follows two F# style guides: the F# code formatting guidelines from Microsoft by default and the G-Research F# code formatting guidelines via various settings.
Contributing Guidelines
See the Contribution Guidelines.
Credits
We would like to gratefully thank the following persons for their contributions.
License
The library and tool are available under Apache 2.0 license.
For more information see the License file.



### [JetBrains Rider
](https://fsprojects.github.io/fantomas/docs/end-users/Rider.html)


JetBrains Rider
The resharper-fsharp uses Fantomas under the hood to format the source code. No need for any additional plugins.
From Rider 2022.2 onwards, Rider can detect your dotnet Fantomas installation, either globally or locally.
Install Fantomas locally with:
dotnet tool install fantomas


Prior to Rider 2022.3 it did not respect the default settings of Fantomas.
If you are stuck on version 2022.2 (or earlier) consider adding the default settings of Fantomas to your .editorconfig file.



### [Ignore Files
](https://fsprojects.github.io/fantomas/docs/end-users/IgnoreFiles.html)

Notice that are a lot of blank lines between sections.
And the links of a section header are split on two lines. I see no reason to do this.

Improve the code and verify your own work by running

dotnet run --project src/fsdocs-tool/fsdocs-tool.fsproj -- build

this will create files in ./output/ (find via ls -l ./output/llms*.txt)

… blank lines

- Trim and collapse internal whitespace in entry titles so link text
  is always on a single line (e.g. 'Fantomas\n' → 'Fantomas')
- Collapse 3+ consecutive newlines to at most 2 in cleaned content,
  preventing large gaps between sections in llms-full.txt
- Trim leading/trailing whitespace from cleaned content
- Add two new tests covering both behaviours

Addresses feedback from @nojaf on PR #980.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

✅ Commit pushed: 348d8ca

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

I've addressed your feedback from the latest review:

What was fixed:

  1. Multi-line link titles — Entry titles are now trimmed and all internal whitespace (including newlines) is collapsed to a single space before being placed in the [...] part of the link. So [Fantomas\n](url) becomes [Fantomas](url).

  2. Excessive blank lines — The content cleaning pipeline now collapses 3 or more consecutive newlines down to at most 2, and trims leading/trailing whitespace from each entry's content. This removes the large gaps between sections you saw in the output.

Two new tests covering both behaviours were added and all 15 LlmsTxt tests pass.

Generated by Repo Assist

To install this workflow, run gh aw add githubnext/agentics/workflows/repo-assist.md@828ac109efb43990f59475cbfce90ede5546586c. View source at https://github.com/githubnext/agentics/tree/828ac109efb43990f59475cbfce90ede5546586c/workflows/repo-assist.md.

@nojaf
Copy link
Collaborator

nojaf commented Feb 24, 2026

/repo-assist

So, right now llms.txt will generate

# FSharp.Formatting

## Docs

- [Markdown parser](https://fsprojects.github.io/FSharp.Formatting/markdown.html)
- [Embedding script output](https://fsprojects.github.io/FSharp.Formatting/evaluation.html)
- [Code formatting](https://fsprojects.github.io/FSharp.Formatting/codeformat.html)
- [Literate Scripts](https://fsprojects.github.io/FSharp.Formatting/literate.html)
- [Creating Content](https://fsprojects.github.io/FSharp.Formatting/content.html)
- [Users of FSharp.Formatting](https://fsprojects.github.io/FSharp.Formatting/users.html)
- [F# Formatting: Documentation Tools for F# Code](https://fsprojects.github.io/FSharp.Formatting/index.html)
- [Customization and Styling](https://fsprojects.github.io/FSharp.Formatting/styling.html)
- [Upgrading to fsdocs](https://fsprojects.github.io/FSharp.Formatting/upgrade.html)
- [Getting Started](https://fsprojects.github.io/FSharp.Formatting/zero-to-hero.html)
- [Command line](https://fsprojects.github.io/FSharp.Formatting/commandline.html)
- [Literate Notebooks](https://fsprojects.github.io/FSharp.Formatting/literate-notebook.html)
- [Generating API Docs](https://fsprojects.github.io/FSharp.Formatting/apidocs.html)
- [Mermaid Diagrams](https://fsprojects.github.io/FSharp.Formatting/sidebyside/sidemermaid.html)
- [Markdown Content](https://fsprojects.github.io/FSharp.Formatting/sidebyside/sidemarkdown.html)
- [Markdown LaTeX](https://fsprojects.github.io/FSharp.Formatting/sidebyside/sideextensions.html)
- [Literate Script](https://fsprojects.github.io/FSharp.Formatting/sidebyside/sidescript.html)
- [Example: Styling for Right-Side Navigation Bar](https://fsprojects.github.io/FSharp.Formatting/templates/leftside/styling.html)
## API Reference

- [FSharp.Formatting.ApiDocs](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs.html)
- [FSharp.Formatting.CSharpFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat.html)
- [FSharp.Formatting.CodeFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat.html)
- [FSharp.Formatting.Common](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-common.html)
- [FSharp.Formatting.Literate](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate.html)
- [FSharp.Formatting.Literate.Evaluation](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation.html)
- [FSharp.Formatting.Markdown](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown.html)
- [FSharp.Formatting.Templating](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-templating.html)
- [ApiDocAttribute](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocattribute.html)
- [ApiDocCollection](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidoccollection.html)
- [ApiDocComment](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidoccomment.html)
- [ApiDocEntity](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocentity.html)
- [ApiDocEntityInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocentityinfo.html)
- [ApiDocFileExtensions](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocfileextensions.html)
- [ApiDocHtml](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidochtml.html)
- [ApiDocInput](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocinput.html)
- [ApiDocMember](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocmember.html)
- [ApiDocMemberDetails](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocmemberdetails.html)
- [ApiDocMemberKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocmemberkind.html)
- [ApiDocModel](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocmodel.html)
- [ApiDocNamespace](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocnamespace.html)
- [ApiDocType](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidoctype.html)
- [ApiDocs](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocs.html)
- [ApiDocsSearchIndexEntry](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-apidocssearchindexentry.html)
- [Attribute](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-attribute.html)
- [DocComment](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-doccomment.html)
- [Member](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-member.html)
- [MemberKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-memberkind.html)
- [Module](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-module.html)
- [ModuleInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-moduleinfo.html)
- [Type](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-type.html)
- [TypeInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-apidocs-typeinfo.html)
- [CLikeFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-clikeformat.html)
- [CPlusPlusFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-cplusplusformat.html)
- [CSharpFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-csharpformat.html)
- [CodeFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-codeformat.html)
- [FSharpFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-fsharpformat.html)
- [HaskellFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-haskellformat.html)
- [HtmlFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-htmlformat.html)
- [JavaScriptFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-javascriptformat.html)
- [MshFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-mshformat.html)
- [PaketFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-paketformat.html)
- [PhpFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-phpformat.html)
- [SourceFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-sourceformat.html)
- [SyntaxHighlighter](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-syntaxhighlighter.html)
- [TsqlFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-tsqlformat.html)
- [TypeScriptFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-typescriptformat.html)
- [VisualBasicFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-csharpformat-visualbasicformat.html)
- [CodeFormatter](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-codeformatter.html)
- [CodeFormat](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-codeformat.html)
- [ErrorKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-errorkind.html)
- [FormattedContent](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-formattedcontent.html)
- [FormattedSnippet](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-formattedsnippet.html)
- [Line](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-line.html)
- [Snippet](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-snippet.html)
- [SourceError](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-sourceerror.html)
- [TokenKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-tokenkind.html)
- [TokenSpan](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-tokenspan.html)
- [TokenSpans](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-tokenspans.html)
- [ToolTipSpan](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-tooltipspan.html)
- [ToolTipSpans](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-codeformat-tooltipspans.html)
- [Menu](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-common-menu.html)
- [MenuItem](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-common-menu-menuitem.html)
- [PageContentList](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-common-pagecontentlist.html)
- [MarkdownPatterns](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-markdownpatterns.html)
- [IndexText](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-indextext.html)
- [Literate](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literate.html)
- [LiterateCodeOptions](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literatecodeoptions.html)
- [LiterateCodeVisibility](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literatecodevisibility.html)
- [LiterateDocument](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literatedocument.html)
- [LiterateParagraph](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literateparagraph.html)
- [LiterateParagraphOptions](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literateparagraphoptions.html)
- [LiterateSource](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-literatesource.html)
- [OutputKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-outputkind.html)
- [FsiEmbedKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-fsiembedkind.html)
- [FsiEvaluationFailedInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-fsievaluationfailedinfo.html)
- [FsiEvaluationResult](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-fsievaluationresult.html)
- [FsiEvaluator](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-fsievaluator.html)
- [FsiEvaluatorConfig](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-fsievaluatorconfig.html)
- [IFsiEvaluationResult](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-ifsievaluationresult.html)
- [IFsiEvaluator](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-literate-evaluation-ifsievaluator.html)
- [Dsl](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-dsl.html)
- [HtmlFormatting](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-htmlformatting.html)
- [MarkdownPatterns](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns.html)
- [ParagraphLeafInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns-paragraphleafinfo.html)
- [ParagraphNestedInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns-paragraphnestedinfo.html)
- [ParagraphSpansInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns-paragraphspansinfo.html)
- [SpanLeafInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns-spanleafinfo.html)
- [SpanNodeInfo](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownpatterns-spannodeinfo.html)
- [Markdown](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdown.html)
- [MarkdownColumnAlignment](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdowncolumnalignment.html)
- [MarkdownDocument](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdowndocument.html)
- [MarkdownEmbedParagraphs](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownembedparagraphs.html)
- [MarkdownEmbedSpans](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownembedspans.html)
- [MarkdownListKind](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownlistkind.html)
- [MarkdownParagraph](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownparagraph.html)
- [MarkdownParagraphs](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownparagraphs.html)
- [MarkdownParseOptions](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownparseoptions.html)
- [MarkdownSpan](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownspan.html)
- [MarkdownSpans](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownspans.html)
- [MarkdownTableRow](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdowntablerow.html)
- [MarkdownRange](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownrangemodule.html)
- [MarkdownRange](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-markdown-markdownrange.html)
- [ParamKeys](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-templating-paramkeys.html)
- [FrontMatterFile](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-templating-frontmatterfile.html)
- [ParamKey](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-templating-paramkey.html)
- [Substitutions](https://fsprojects.github.io/FSharp.Formatting/reference/fsharp-formatting-templating-substitutions.html)

I'm not convinced this is useful for LLMs.

If the current project has an _template.md file it will generate markdown for all content as well. If this is the case, it should link to md files, which are more useful for LLMs.

You need to update this and I would argue that markdown output should also be generated by default when FsDocsGenerateLlmsTxt is enabled.

@dsyme do you agree?

@dsyme
Copy link
Contributor

dsyme commented Feb 25, 2026

If the current project has an _template.md file it will generate markdown for all content as well. If this is the case, it should link to md files, which are more useful for LLMs.

You need to update this and I would argue that markdown output should also be generated by default when FsDocsGenerateLlmsTxt is enabled.

@dsyme do you agree?

@nojaf I agree. Would be interesting to compare with other llms.txt for other langauges

@dsyme
Copy link
Contributor

dsyme commented Feb 25, 2026

@nojaf Do you want FsDocsGenerateLlmsTxt on by default (so markdown will also be generated by default)?

I think I would be OK with this given the modern era we're in

@nojaf
Copy link
Collaborator

nojaf commented Feb 26, 2026

/repo-assist please act on my comment in #980 (comment)

@nojaf
Copy link
Collaborator

nojaf commented Feb 26, 2026

@dsyme yes, enabled by default make a lot of sense.

…enerateLlmsTxt is enabled

- When FsDocsGenerateLlmsTxt is enabled (the default), prefer markdown
  templates for both API docs and doc content so that .md files are
  written alongside HTML output.
- Bundle docs/_template.md as a package template so that markdown
  output is generated even when the user has not provided their own
  _template.md.
- LlmsTxt.buildContent now accepts docContentUsesMarkdown and
  apiDocUsesMarkdown flags and transforms URIs accordingly: .html
  links become .md, and markdown API-doc URIs (InUrl='') get .md
  appended.
- API docs template selection now prefers _template.md over
  _template.html when generateLlmsTxt is enabled.
- DocContent.Convert accepts an optional defaultMdTemplate parameter
  that is passed as the initial markdown template to processFolder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 882ef16

Generated by Repo Assist

@github-actions

This comment has been minimized.

@nojaf nojaf closed this Feb 26, 2026
@nojaf nojaf reopened this Feb 26, 2026
@nojaf
Copy link
Collaborator

nojaf commented Feb 26, 2026

/repo-assist

I'm still a little torn about the _template.md, llms.txt will have most benefit if the links lead to markdown files. But most users might not have _template.md file so when upgrading our new feature will be sub optimal.

Can you add some sort of warning message that if no _template.md file was found.
And this is recommended.

Also fix the build!

@dsyme
Copy link
Contributor

dsyme commented Feb 26, 2026

/repo-assist See comment from @nojaf above.

Also about this:

Preferring _template.md for API docs when FsDocsGenerateLlmsTxt = true means that for users who have both _template.html and _template.md, API docs will now be generated as markdown (reference/type.md) rather than HTML (reference/type.html). The HTML nav links in _template.html already reference the API pages using clean URLs (InUrl = ""), so they should still work — but this is worth verifying. If the behaviour change is undesirable, the ordering can be conditioned on the absence of _template.html rather than the presence of _template.md.

This is indeed a problem - turning on FsDocsGenerateLlmsTxt should also generate markdown - it shouldn't switch to markdown.

I didn't actually see in the docs anything about how to turn on markdown documentation generation and whether that can be done in addition to HTML or other output, so we probably have documentation gaps too.

Do what you can but we might have to rethink this if it gets too complex

@nojaf
Copy link
Collaborator

nojaf commented Feb 26, 2026

@dsyme I believe it happens now if the user has a _template.md file.
This file needs to exists, but can be empty.
Maybe we should always generated markdown when FsDocsGenerateLlmsTxt is enabled?
And assume empty template if no _template.md is present?

…stead of it

- Restore HTML-first template ordering for API docs (was incorrectly switched
  to markdown-first when FsDocsGenerateLlmsTxt was enabled, causing API docs
  to be emitted as .md instead of .html when _template.md existed)
- Remove markdown fallback when no user templates found; use HTML default instead
- Add warning when FsDocsGenerateLlmsTxt is enabled but no _template.md found,
  advising users to add one for better LLM-friendly output
- Fix StringComparison.Ordinal in StartsWith call (code scanning alert)
- Fix test compilation: update LlmsTxt.buildContent calls to pass required
  docContentUsesMarkdown and apiDocUsesMarkdown arguments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: c8d602b

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

I've pushed fixes addressing @dsyme's and @nojaf's feedback:

Changes made

1. Fix: FsDocsGenerateLlmsTxt no longer switches API docs from HTML to markdown

The template ordering for API docs has been restored to HTML-first, regardless of FsDocsGenerateLlmsTxt. Previously, enabling this property would prefer _template.md over _template.html for API reference generation — causing users with both templates to get .md files instead of .html files. Now it correctly keeps HTML as primary and only uses markdown if no HTML template is found.

The doc content layer already generates .md alongside .html when FsDocsGenerateLlmsTxt is enabled (via the defaultMdTemplate passed to docContent.Convert), so that path remains correct.

2. Add: Warning when no _template.md found

When FsDocsGenerateLlmsTxt is enabled but no _template.md exists in the docs folder, a note is printed:

note: FsDocsGenerateLlmsTxt is enabled but no '_template.md' was found in 'docs'.
      Consider adding a '_template.md' to generate Markdown pages alongside HTML.
      Markdown output is more suitable for LLM consumption (see (fsprojects.github.io/redacted)

3. Fix: Build errors in tests

The LlmsTxt.buildContent calls in DocContentTests.fs were missing the two new boolean arguments (docContentUsesMarkdown and apiDocUsesMarkdown) — all 16 calls updated to pass false false.

4. Fix: Code scanning alert

Added StringComparison.Ordinal to the StartsWith call flagged at line 1317.


Note on "also generate markdown for API docs": Currently API docs can only be generated in one format per run (HTML or Markdown). Generating both in the same run would require a second pass through ApiDocs.GenerateMarkdownPhased, which is a larger architectural change. For now, apiDocUsesMarkdown in llms.txt will only be true when the user has a markdown template but no HTML template. This is worth a follow-up issue if generating both is desired.

Test status: Build succeeds, all 116 literate tests pass.

Generated by Repo Assist for issue #980

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

@dsyme
Copy link
Contributor

dsyme commented Feb 26, 2026

@nojaf Not sure this feature is worth it if it only kicks in when generating markdown docs (and not HTML).

wdyt should we ask it to do the work to allow two doc type generations? I guess that's the solution?

@nojaf
Copy link
Collaborator

nojaf commented Feb 26, 2026

@dsyme I would do the following:

FsDocsGenerateLlmsTxt is on by default, and because it is on we generate markdown as well regardless of the presence of _template.md.

If you turn of FsDocsGenerateLlmsTxt and have no _template.md it does not generate markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for llms.txt

2 participants