Skip to content

Add markdown API reference routes and enable page actions#687

Merged
IEvangelist merged 5 commits intomainfrom
dapine/api-markdown-actions
Apr 7, 2026
Merged

Add markdown API reference routes and enable page actions#687
IEvangelist merged 5 commits intomainfrom
dapine/api-markdown-actions

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

@IEvangelist IEvangelist commented Apr 7, 2026

Summary

Adds prerendered markdown endpoints for the API reference so the C# and TypeScript docs can be fetched as .md at the index, package/module, type/item, and member levels.

What changed

  • add shared markdown rendering utilities plus dedicated C# and TypeScript markdown renderers
  • add markdown route handlers under /reference/api/csharp*.md and /reference/api/typescript*.md
  • enable page actions on the API reference pages and add middleware to normalize nested .md route redirects
  • extend the API metadata models so markdown output can include summaries, descriptions, signatures, and capabilities
  • add targeted unit and Playwright coverage for the new markdown routes
  • add a build:skip-search mode for builds and route checks that should not generate pagefind output

Copilot AI review requested due to automatic review settings April 7, 2026 19:32
@IEvangelist IEvangelist changed the title Add MD routes for API docs and page actions Add markdown API reference routes and enable page actions Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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}/...*.md that 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 .md paths.

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.

Comment on lines +68 to +74
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)) },
]);
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
- 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.
Copy link
Copy Markdown
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

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

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?

@IEvangelist IEvangelist force-pushed the dapine/api-markdown-actions branch from 672ebdd to 40662a8 Compare April 7, 2026 19:59
Copy link
Copy Markdown
Contributor

@maddymontaquila maddymontaquila left a comment

Choose a reason for hiding this comment

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

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>
@IEvangelist
Copy link
Copy Markdown
Member Author

Addressed the build/lint failures and the Copilot feedback in cc3a4274.

Updated:

  • removed the dead moduleLinkBase workaround
  • normalized C# note blockquote rendering to avoid nested > > output
  • pinned TypeScript markdown Source links to sourceCommit when available
  • typed the markdown route props/model usage to satisfy the frontend lint gate
  • expanded the markdown unit coverage for the new note/source-link behavior

I did not run any additional pnpm build commands after your request.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist enabled auto-merge (squash) April 7, 2026 20:59
@IEvangelist IEvangelist merged commit 292d328 into main Apr 7, 2026
5 checks passed
@IEvangelist IEvangelist deleted the dapine/api-markdown-actions branch April 7, 2026 21:00
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.

4 participants