Add markdown API reference routes and enable page actions#687
Add markdown API reference routes and enable page actions#687IEvangelist merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds markdown (.md) API endpoints for the C# and TypeScript reference areas and enables page actions on the corresponding HTML pages, with unit/e2e coverage to ensure the markdown routes serve the expected content types and headings.
Changes:
- Add prerendered Astro API routes under
/reference/api/{csharp|typescript}/...*.mdthat render generated markdown for index/module/type/member pages. - Introduce shared markdown helpers plus new C#/TypeScript markdown renderers and extend package/ts-module typings to carry doc metadata used in output.
- Add unit + Playwright coverage for markdown routes, plus build/test scripts and a middleware redirect for nested
.mdpaths.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/utils/api-markdown-shared.ts | Shared markdown formatting helpers + text/markdown response utility. |
| src/frontend/src/utils/csharp-api-markdown.ts | C# API markdown renderer for index/package/type/member-kind pages. |
| src/frontend/src/utils/typescript-api-markdown.ts | TypeScript API markdown renderer for index/module/item/member pages. |
| src/frontend/src/pages/reference/api/csharp.md.ts | Markdown endpoint for the C# API index. |
| src/frontend/src/pages/reference/api/csharp/[package].md.ts | Markdown endpoint for a C# package page. |
| src/frontend/src/pages/reference/api/csharp/[package]/[type].md.ts | Markdown endpoint for a C# type page. |
| src/frontend/src/pages/reference/api/csharp/[package]/[type]/[memberKind].md.ts | Markdown endpoint for C# member-kind pages. |
| src/frontend/src/pages/reference/api/typescript.md.ts | Markdown endpoint for the TypeScript API index. |
| src/frontend/src/pages/reference/api/typescript/[module].md.ts | Markdown endpoint for a TypeScript module page. |
| src/frontend/src/pages/reference/api/typescript/[module]/[item].md.ts | Markdown endpoint for TypeScript handle/dto/enum/function items. |
| src/frontend/src/pages/reference/api/typescript/[module]/[item]/[member].md.ts | Markdown endpoint for TypeScript handle members (methods). |
| src/frontend/src/pages/reference/api/csharp/**/*.astro | Enable pageActions on HTML API pages. |
| src/frontend/src/pages/reference/api/typescript/**/*.astro | Enable pageActions on HTML API pages + improve search index fallback fields. |
| src/frontend/src/middleware.ts | Redirect nested .md API routes to a trailing-slash form. |
| src/frontend/tests/unit/api-markdown.vitest.test.ts | Unit tests importing .md.ts route modules and validating markdown output. |
| src/frontend/tests/e2e/api-markdown-routes.spec.ts | E2E coverage ensuring markdown routes serve text/markdown and expected headings. |
| src/frontend/playwright.api-markdown.config.mjs | Dedicated Playwright config for markdown route checks. |
| src/frontend/src/utils/ts-modules.ts | Extend TS API types to include signature/description/capabilities metadata. |
| src/frontend/src/utils/packages.ts | Extend C# package types to include docs summary for types/members. |
| src/frontend/astro.config.mjs | Add --mode skip-search handling to disable pagefind during build. |
| src/frontend/package.json | Add build/test scripts for skip-search build and markdown route tests. |
| package.json | Add root build:skip-search passthrough script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const metadata = keyValueBullets([ | ||
| { label: 'Module', value: inlineCode(pkg.package.name) }, | ||
| { label: 'Version', value: pkg.package.version ? inlineCode(pkg.package.version) : null }, | ||
| { label: 'Source', value: pkg.package.sourceRepository ? link('GitHub', pkg.package.sourceRepository) : null }, | ||
| { label: 'Functions', value: inlineCode(String(standaloneFunctions.length)) }, | ||
| { label: 'Types', value: inlineCode(String(allTypes.length + allEnums.length)) }, | ||
| ]); |
There was a problem hiding this comment.
The TypeScript module/item metadata links Source to pkg.package.sourceRepository but ignores pkg.package.sourceCommit (which exists in the tsModules schema). Consider linking to a commit-pinned URL (e.g., .../tree/<commit> or .../blob/<commit>/...) to keep the reference stable and consistent with the C# API markdown pages.
- Implement TypeScript API markdown generation in `typescript-api-markdown.ts` with functions for rendering index, modules, items, and members. - Create e2e tests for API markdown routes in `api-markdown-routes.spec.ts` to ensure correct markdown responses for C# and TypeScript routes. - Add unit tests for API markdown routes in `api-markdown.vitest.test.ts` to validate markdown generation for various API components including modules, types, and functions.
adamint
left a comment
There was a problem hiding this comment.
Don't block on this comment but the API docs feel a little cluttered and clunky to use as a human. It feels like too menu clicks
is part of the goal not to appear like the ms learn api reference? which seems more compact https://learn.microsoft.com/en-us/dotnet/api/microsoft.csharp.runtimebinder.csharpargumentinfo?view=net-10.0
Unrelated to api docs but re: docs in general, I don't really see the benefit of the terminal preview for commands? It seems like it's just duplicating information? Am I missing something?
672ebdd to
40662a8
Compare
maddymontaquila
left a comment
There was a problem hiding this comment.
Looks good to me. The API markdown generation flow, routing updates, and coverage all line up cleanly, and I didn’t spot any substantive issues.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the build/lint failures and the Copilot feedback in Updated:
I did not run any additional |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Adds prerendered markdown endpoints for the API reference so the C# and TypeScript docs can be fetched as
.mdat the index, package/module, type/item, and member levels.What changed
/reference/api/csharp*.mdand/reference/api/typescript*.md.mdroute redirectsbuild:skip-searchmode for builds and route checks that should not generate pagefind output