Skip to content

Unfurl MultiLangCodeBlock examples in generated markdown - #1569

Draft
MikeCarbone wants to merge 2 commits into
mainfrom
cursor/code-block-unfurling-7430
Draft

Unfurl MultiLangCodeBlock examples in generated markdown#1569
MikeCarbone wants to merge 2 commits into
mainfrom
cursor/code-block-unfurling-7430

Conversation

@MikeCarbone

@MikeCarbone MikeCarbone commented Jul 28, 2026

Copy link
Copy Markdown
Member

Description

Generated markdown pages (Copy for LLM, Accept: text/markdown, llms.txt) were missing usable example code in two places:

  1. Docs pages left <MultiLangCodeBlock /> tags unresolved (or stripped them in API overview content).
  2. API reference method pages only emitted params + response JSON, and omitted the request example the UI shows (cURL / SDK snippets from x-stainless-snippets).

This unfurls a single preferred example per block:

  • Docs MultiLangCodeBlock: prefer Node.js (docs UI default)
  • API method request examples: prefer cURL (language-agnostic, matches the request switcher's first option)
  • Never emit every language variant

Changes:

  • Extract the docs snippet registry into data/code/snippets.ts
  • Convert <MultiLangCodeBlock /> in convertMdxForLlm and API overview markdown
  • Extend getMethodMarkdownContent to emit a request example via augmentSnippetsWithCurlRequest, preferring cURL

Tasks

Linear Issue: KNO-14441

Open in Web Open in Cursor 

Generated LLM/markdown pages left <MultiLangCodeBlock /> tags unresolved
(or stripped them in API overview content). Resolve snippets to a single
preferred language (Node.js, matching the docs UI default) so copied and
llms.txt content includes real example code without every language variant.

Co-authored-by: Mike Carbone <MikeCarbone@users.noreply.github.com>
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

KNO-14441

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 29, 2026 3:00pm

Request Review

Copy link
Copy Markdown
Member Author

@cursor this doesn't seem to work. For example, the API reference page, I'd expect there to be an example Request CURL and a response in the markdown. Instead, this is what I see. Compared to the screenshot that has a lot more info.

Screenshot 2026-07-29 at 10.52.03 AM.png

### List workflow recipient runs

Returns a paginated list of workflow recipient runs for the current environment.

#### Endpoint

`GET /v1/workflow_recipient_runs`

**Rate limit tier:** 2

#### Query parameters

- **after** (string) - The cursor to fetch entries after.
- **before** (string) - The cursor to fetch entries before.
- **page_size** (integer) - The number of items per page (defaults to 50).
- **workflow** (string) - Limits the results to workflow recipient runs for the given workflow key.
- **status** (array) - Limits the results to workflow recipient runs with the given status.
- **tenant** (string) - Limits the results to workflow recipient runs for the given tenant.
- **has_errors** (boolean) - Limits the results to workflow recipient runs that have errors.
- **recipient** (string) - Limits the results to workflow recipient runs for the given recipient. Accepts a user ID string or an object reference with `id` and `collection`.
- **starting_at** (string) - Limits the results to workflow recipient runs started after the given date.
- **ending_at** (string) - Limits the results to workflow recipient runs started before the given date.

#### Responses

##### 200

OK

###### Example

```json
{
  "items": [
    {
      "__typename": "WorkflowRecipientRun",
      "actor": "user_456",
      "error_count": 0,
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "inserted_at": "2025-01-01T00:00:00Z",
      "recipient": "user_123",
      "status": "completed",
      "tenant": "tenant_abc",
      "trigger_source": {
        "cancellation_key": "comment-123-user-456",
        "type": "api"
      },
      "updated_at": "2025-01-01T00:05:00Z",
      "workflow": "comment-created",
      "workflow_run_id": "660e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "page_info": {
    "__typename": "PageInfo",
    "after": null,
    "before": null,
    "page_size": 25
  }
}

<!-- linear:isThreadRoot -->

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

The first fix only covered docs MultiLangCodeBlocks. API method pages are a separate path and never included request examples.

I updated getMethodMarkdownContent to reuse the UI’s request-example source (x-stainless-snippets + synthesized cURL) and unfurl a single preferred language: cURL. The response JSON example stays as-is.

workflow_recipient_runs/list.md now has both the request cURL and the 200 response. Pushed to #1569.

Open in Web Open in Cursor 

API method pages only emitted params and response JSON, so Copy for LLM
missed the request example shown in the UI. Reuse the stainless snippet
plus synthesized cURL path and unfurl a single preferred language (cURL)
into each generated method page.

Co-authored-by: Mike Carbone <MikeCarbone@users.noreply.github.com>
@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

Good catch — the first change only covered docs <MultiLangCodeBlock /> examples. API reference method pages are a separate codegen path and were only emitting params + response JSON.

Pushed a follow-up that:

  1. Reuses the same request-example source as the UI (x-stainless-snippets + synthesized cURL via augmentSnippetsWithCurlRequest)
  2. Unfurls a single preferred language: cURL
  3. Keeps the existing response JSON example

/api-reference/workflow_recipient_runs/list.md now includes both the request cURL and the 200 response example.

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.

2 participants