Skip to content

Add support for llms.txt - #903

Open
thokra-nav wants to merge 2 commits into
mainfrom
llm.txt
Open

thokra-nav wants to merge 2 commits into
mainfrom
llm.txt

Conversation

@thokra-nav

Copy link
Copy Markdown
Contributor

Add a .md endpoint to all pages, and a llms-full.txt with full doc

Add a `.md` endpoint to all pages, and a `llms-full.txt` with full doc
Copilot AI lite review requested due to automatic review settings September 18, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

One or more issues must be addressed before approval.

Pull request overview

Adds Markdown representations for documentation pages and generates llms.txt and llms-full.txt endpoints for AI tooling.

Changes:

  • Adds Markdown routes and alternate links.
  • Implements Markdown serialization and LLM index/full-document generation.
  • Adds curation metadata and improves template processing.
File summaries
File Description
svdoc/src/routes/llms.txt/+server.ts Updated as part of this pull request.
svdoc/src/routes/llms-full.txt/+server.ts Updated as part of this pull request.
svdoc/src/routes/[...path]/+page.svelte Updated as part of this pull request.
svdoc/src/routes/[...path].md/+server.ts Updated as part of this pull request.
svdoc/src/lib/types/tokens.ts Updated as part of this pull request.
svdoc/src/lib/markdown.ts Updated as part of this pull request.
svdoc/src/lib/llms.ts Updated as part of this pull request.
svdoc/src/lib/llms.test.ts Updated as part of this pull request.
svdoc/src/lib/helpers/urls.ts Updated as part of this pull request.
svdoc/src/lib/helpers/templates.ts Updated as part of this pull request.
svdoc/src/lib/helpers/templates.test.ts Updated as part of this pull request.
svdoc/src/lib/content-store.ts Updated as part of this pull request.
README.md Updated as part of this pull request.
docs/workloads/README.md Updated as part of this pull request.
docs/workloads/job/README.md Updated as part of this pull request.
docs/workloads/application/README.md Updated as part of this pull request.
docs/workloads/application/how-to/create.md Updated as part of this pull request.
docs/tutorials/hello-nais.md Updated as part of this pull request.
docs/services/secrets/README.md Updated as part of this pull request.
docs/services/README.md Updated as part of this pull request.
docs/README.md Updated as part of this pull request.
docs/persistence/valkey/README.md Updated as part of this pull request.
docs/persistence/README.md Updated as part of this pull request.
docs/persistence/opensearch/README.md Updated as part of this pull request.
docs/persistence/kafka/README.md Updated as part of this pull request.
docs/persistence/cloudsql/README.md Updated as part of this pull request.
docs/operate/README.md Updated as part of this pull request.
docs/observability/tracing/README.md Updated as part of this pull request.
docs/observability/README.md Updated as part of this pull request.
docs/observability/metrics/README.md Updated as part of this pull request.
docs/observability/logging/README.md Updated as part of this pull request.
docs/explanations/nais.md Updated as part of this pull request.
docs/build/README.md Updated as part of this pull request.
docs/build/how-to/build-and-deploy.md Updated as part of this pull request.
docs/auth/README.md Updated as part of this pull request.
docs/auth/idporten/README.md Updated as part of this pull request.
docs/auth/entra-id/README.md Updated as part of this pull request.
Review details

Suppressed comments (3)

svdoc/src/lib/helpers/templates.ts:482

  • Raw protection happens before includes are expanded, so a {% raw %}...{% endraw %} block coming from an included file is inserted after the placeholder pass and then still goes through processVariables/processConditionals. For example, <<tenant()>> inside an included raw block will be expanded, unlike the same block in the parent file. Apply the raw-block protection recursively while expanding includes (or protect included content before the subsequent processing passes), and add a regression test for an included raw block.
	let result = content.replace(
		/\{%-?\s*raw\s*-?%\}([\s\S]*?)\{%-?\s*endraw\s*-?%\}/g,
		(_, body: string) => {
			const index = rawBlocks.push(body) - 1;
			return `@@SVDOCRAW${index}@@`;
		},
	);

svdoc/src/lib/helpers/urls.ts:179

  • When BASE_PATH is configured (for example /docs), stripBase removes any string prefix, not just the path-segment prefix. A valid page such as /docs-other is therefore converted to -other.md here, breaking its alternate link (and the same helper is used for generated llms links). Strip the base only when the path equals it or starts with ${BASE_PATH}/.
	const rawPath = stripBase(pathPart || "/");
	const normalizedPath = collapseSlashes(rawPath || "/");

svdoc/src/lib/llms.ts:425

  • Protocol-relative links such as [service](//status.example.com) are treated as internal here because isExternalHref does not recognize the // scheme. The serializer then turns them into a malformed Markdown link like [/status.example.com.md](/status.example.com.md), so external links lose their destination in the new representations. Treat protocol-relative URLs as external before applying the .md conversion.
  • Files reviewed: 37/37 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thokra-nav
thokra-nav marked this pull request as draft September 18, 2026 12:42
@thokra-nav
thokra-nav marked this pull request as ready for review September 29, 2026 07:15
@thokra-nav
thokra-nav requested a balanced review from Copilot September 29, 2026 07:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Ordered-list serialization breaks nested content by using insufficient continuation indentation.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread svdoc/src/lib/llms.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants