Skip to content

feat: implement Markdown domain in GitHub API simulator - #47

Open
pmcelhaney with Copilot wants to merge 4 commits into
mainfrom
copilot/implement-markdown-domain
Open

feat: implement Markdown domain in GitHub API simulator#47
pmcelhaney with Copilot wants to merge 4 commits into
mainfrom
copilot/implement-markdown-domain

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

POST /markdown and POST /markdown/raw previously returned random stub responses. This implements a functional Markdown-to-HTML renderer backed by a proper Context class, with deterministic output and correct response headers.

Original Prompt

Implement Markdown domain in the GitHub API simulator and create a PR

Manual acceptance tests

  • POST /markdown with {"text": "# Hello"} returns 200 with Content-Type: text/html and body containing <h1>Hello</h1>
  • POST /markdown with {"text": "**bold** and *italic*"} returns body with <strong>bold</strong> and <em>italic</em>
  • POST /markdown with {"text": "See #42", "mode": "gfm", "context": "octocat/hello-world"} returns a link to https://github.com/octocat/hello-world/issues/42
  • POST /markdown/raw with plain-text body # Raw returns 200 and body containing <h1>Raw</h1>
  • Both endpoints return an X-CommonMarker-Version header
  • Fenced code block containing <script> returns &lt;script&gt; — not a live tag

Tasks

  • routes/markdown/_.context.ts — new Context class; renders headings, paragraphs, bold/italic/strikethrough, inline code, fenced code blocks (with language class), lists, blockquotes, HR, links, images, and GFM issue refs (#42<a href="…">); escapes HTML in code blocks
  • routes/markdown.ts — delegates to context; sets Content-Type, Content-Length, X-CommonMarker-Version
  • routes/markdown/raw.ts — delegates to renderRaw(); sets X-CommonMarker-Version
  • routes/_.context.ts — adds MarkdownContext delegation: renderMarkdown, renderRaw, commonMarkerVersion
  • test-support/create-context.ts — registers /markdown context path
  • test-support/create-response.ts — shared response builder mock with arbitrary header-chain support
  • test/markdown.context.test.ts — 15 unit tests for Context
  • test/markdown.routes.test.ts — 5 HTTP-level route tests

Copilot AI review requested due to automatic review settings July 20, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI requested a review from pmcelhaney July 20, 2026 15:37
@pmcelhaney
pmcelhaney marked this pull request as ready for review July 20, 2026 15:49
@pmcelhaney
pmcelhaney added this pull request to the merge queue Jul 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jul 20, 2026
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.

3 participants