-
Notifications
You must be signed in to change notification settings - Fork 5
Docs llm copy issue #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Docs llm copy issue #1250
Conversation
Co-authored-by: chris <chris@knock.app>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| table += `| \`${attr.name}\` | \`${attr.type || "any"}\` | ${ | ||
| attr.description | ||
| } | ${attr.required ? "Yes" : "No"} |\n`; | ||
| } |
There was a problem hiding this comment.
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.
|
|
||
| // Extract description | ||
| const descMatch = attrString.match(/description="([^"]+)"/); | ||
| const description = descMatch ? descMatch[1] : ""; |
There was a problem hiding this comment.
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.
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.tsscript to:<Typedoc file="..." />components and merge the actual content from the corresponding/typedocs/MDX files into the generated markdown.<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
Tasks
Screenshots
Linear Issue: KNO-10467