Markdown for agents: Accept text/markdown negotiation#43
Draft
Markdown for agents: Accept text/markdown negotiation#43
Conversation
- Add shared Turndown-based HTML→markdown helpers and token estimate header - Serve markdown from static preview and self-hosted servers when markdown wins Accept - Run selfhosted TypeScript compile after next build (postbuild); trim Docker duplicate tsc - Playwright: prefer HTML Accept for UI tests, poll until hash applies, add API negotiation test - Refresh visual snapshots; document behavior in README, deployment, architecture, skills Co-authored-by: Aanish Bhirud <baanish@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying agent-render with
|
| Latest commit: |
dd70aa3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3fc67807.agent-render.pages.dev |
| Branch Preview URL: | https://cursor-markdown-for-agents-9.agent-render.pages.dev |
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.
Summary
Implements Markdown for Agents–style content negotiation for this static export: when
Acceptpreferstext/markdownover HTML, Node-based servers return Markdown withContent-Type: text/markdown; charset=utf-8,Vary: Accept, andx-markdown-tokens(rough estimate from body length).Changes
selfhosted/markdown-for-agents.ts: Turndown conversion,Acceptparsing (ties favor HTML), 2 MB HTML cap aligned with Cloudflare docs.scripts/serve-export.mjs: For GET.htmlfiles, returns markdown when negotiated; loads compiled helper fromselfhosted/dist/afternpm run build.selfhosted/server.ts: Same for static files and UUID viewer pages; markdown error pages when appropriate.postbuild:tsc -p selfhosted/tsconfig.jsonso preview always hasselfhosted/dist/markdown-for-agents.js.playwright.configsetsAcceptto prefer HTML so UI tests still load the app;goToHashwaits untilwindow.location.hashmatches (fixes rare flake).AGENTS.md, self-hosted skill.Note on Cloudflare
Zones with Cloudflare "Markdown for Agents" enabled may convert at the edge; this origin logic covers static hosts, preview, and self-hosted deployments.
Verification
npm run checknpm run test:e2e