fix(copyllm): expand table components in markdown endpoint#11040
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the “Copy for LLM” / “View as Markdown” output by post-processing raw MDX source so that schema-driven table components are expanded into real markdown tables (and MDX import lines are removed), producing more usable plain markdown from the .md endpoint.
Changes:
- Added a
schemaToMarkdownutility that expands<OptionsTable />,<ActionOptionsTable />, and<PullRequestAttributesTable />into markdown tables generated from the config schema. - Added Vitest coverage for MDX expansion behaviors (table replacement, import stripping, blank-line normalization).
- Wired the markdown endpoint (
src/pages/[...slug].md.ts) to run the MDX expansion step before returning the response.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/util/schemaToMarkdown.ts |
Implements MDX-to-markdown transformations and schema-to-table generation. |
src/util/schemaToMarkdown.test.ts |
Adds unit tests validating the expansion and cleanup behaviors. |
src/pages/[...slug].md.ts |
Applies the expansion step to the .md endpoint response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The "Copy for LLM" and "View as Markdown" features served raw MDX source, which included unresolved JSX component tags like `<OptionsTable def="PullRequestRuleModel" />` instead of actual table data. This adds a processing step that replaces OptionsTable, ActionOptionsTable, and PullRequestAttributesTable components with markdown tables generated from the config schema, and strips import statements. Fixes Mergifyio/mergify#5166 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Change-Id: I0629a1f64245b272d8b390677d8e9ba961fd7465
ea76be4 to
2f89f06
Compare
Merge Queue Status
This pull request spent 2 minutes 58 seconds in the queue, including 2 minutes 20 seconds running CI. Required conditions to merge
|
The "Copy for LLM" and "View as Markdown" features served raw MDX source,
which included unresolved JSX component tags like
<OptionsTable def="PullRequestRuleModel" />instead of actual table data.This adds a processing step that replaces OptionsTable, ActionOptionsTable,
and PullRequestAttributesTable components with markdown tables generated
from the config schema, and strips import statements.
Fixes Mergifyio/mergify#5166
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]