Skip to content

Conversation

@cjbell
Copy link
Contributor

@cjbell cjbell commented Jan 8, 2026

Description

This PR resolves an issue where the "Copy for LLM" feature for documentation pages using <Typedoc /> components would only copy the component stub, not the actual documentation content. This resulted in incomplete and unhelpful output for LLMs and users.

The changes modify the generateLlmsTxt.ts script to:

  1. Extract Typedoc Content: Detect <Typedoc file="..." /> components and merge the actual content from the corresponding /typedocs/ MDX files into the generated markdown.
  2. Convert Custom MDX Components: Transform custom <Attributes> and <Attribute> MDX components into standard Markdown tables, improving readability and utility for LLMs.

This ensures that the "Copy for LLM" feature provides comprehensive and well-formatted documentation for all typed component pages.

Todos

  • None

Tasks

Screenshots

  • Not applicable

Linear Issue: KNO-10467

Open in Cursor Open in Web

Co-authored-by: chris <chris@knock.app>
@cursor
Copy link

cursor bot commented Jan 8, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Jan 8, 2026

@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 8, 2026 8:20pm

table += `| \`${attr.name}\` | \`${attr.type || "any"}\` | ${
attr.description
} | ${attr.required ? "Yes" : "No"} |\n`;
}
Copy link

Choose a reason for hiding this comment

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

Pipe characters in descriptions break markdown tables

Medium Severity

The convertAttributesToMarkdown function generates markdown table rows by directly interpolating attr.description into table cells without escaping pipe characters (|). Existing typedoc files contain descriptions with pipe characters (e.g., "One of unseen|unread|all..." in notification-icon-button.mdx). These unescaped pipes will be interpreted as column delimiters, corrupting the markdown table structure and producing malformed output for LLMs.

Fix in Cursor Fix in Web


// Extract description
const descMatch = attrString.match(/description="([^"]+)"/);
const description = descMatch ? descMatch[1] : "";
Copy link

Choose a reason for hiding this comment

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

JSX template literal descriptions silently dropped

Medium Severity

The regex /description="([^"]+)"/ only matches double-quoted string values. However, some typedoc files use JSX template literal syntax like description={\...`}(e.g., inms-teams-auth-button.mdx`). These descriptions won't match the regex and will default to an empty string, silently dropping the actual description content from the generated markdown table.

Fix in Cursor Fix in Web

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.

3 participants