feat(llms): convert ApiLink components to markdown links in generated .md files#339
Draft
viktorkombov wants to merge 4 commits into
Draft
feat(llms): convert ApiLink components to markdown links in generated .md files#339viktorkombov wants to merge 4 commits into
viktorkombov wants to merge 4 commits into
Conversation
…inks to absolute URLs
- Introduced a new module `html-to-md.ts` for converting built Astro HTML pages to Markdown. - Integrated `turndown` and `turndown-plugin-gfm` for Markdown formatting. - Updated `package.json` to include new dependencies for Markdown conversion. - Modified `integration.ts` to utilize the new HTML to Markdown conversion, replacing the previous MDX stripping logic. - Enhanced logging for Markdown generation process and added selector guard for code blocks.
Comment on lines
+108
to
+109
| const rawCode = body | ||
| .replace(/<[^>]+>/g, '') |
Comment on lines
+108
to
+110
| const rawCode = body | ||
| .replace(/<[^>]+>/g, '') | ||
| .replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #338
Improves the generated
.mdversions of documentation pages so they can be reliably parsed by LLMs and coding agents. First step of a broader effort to preserve all meaningful content from MDX source in the LLM-facing markdown output.Previously
<ApiLink>components were stripped entirely from.mdfiles, losing all API identifiers and links. They are now resolved to proper markdown links using the same logic as the rendered HTML.Changes
stripMdxForLlmsconverts<ApiLink …/>to[`IgxToast`](url)(or`IgxToast`fallback when index is unavailable) instead of removing themplatformContextoption added tositeMetaIntegration/createDocsSiteto supply the API index at build timegetPlatformContext()accepts an optional explicit platform name to avoid relying on env varsdocs/angularanddocs/xplatpassplatformContexttocreateDocsSiteigniteui-astro-componentspointed to local repo (pending astro-components PR merge)Verification
<ApiLink type="Grid" />resolves to a working link in the generated.md<ApiLink type="Grid" member="rowSelection" />resolves with correct member anchor<ApiLink kind="sass" module="themes" type="function-avatar-theme" />resolves to correct Sass docs URL<ApiLink label="custom" type="Toast" />uses the label override, not the auto-generated name<ApiLink prefixed={false} type="IgxToast" />skips prefix prepending`TypeName`inline code (no broken links)Checklist:
preview/beta../relative/path.mdIgxSelectComponent,<igx-combo>code blocksfor the names of classes / tags / propertiescode blockscheck-api/mdxnpm commands