Skip to content

docs(chat): wire a Markdown renderer into the chat page samples - #3564

Merged
kojiwakayama merged 2 commits into
mainfrom
fix/dx-20260811-b2-1-2
Aug 11, 2026
Merged

kojiwakayama merged 2 commits into
mainfrom
fix/dx-20260811-b2-1-2

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Found during a DX dogfood walk of the published docs (veryfront 0.1.1228). Two backlog findings, one root cause, so they are fixed together.

Symptom

Following either chat page verbatim produces a chat that renders the assistant's raw Markdown source instead of formatted text.

  • getting-started/create-frontend — asked for "three benefits of TypeScript as a markdown bulleted list with bold headings"; the page showed literal - **Static Type Checking**: .... Even a plain answer rendered inside a code node.
  • guides/chat-ui, "Add the preset UI" — every assistant reply rendered as a raw fenced block with literal ``` fences and ** markers visible.

Both emitted the framework's own warning in the browser console:

[Veryfront] Chat is showing raw Markdown source because no Markdown renderer is
installed. Install one for the chat subtree: ...
New projects scaffold this in app/markdown-renderer.tsx.

Root cause

veryfront/markdown presents plain escaped source until a renderer is installed — the right default for a standalone <Markdown>, but wrong for chat, where the assistant writes Markdown. src/react/components/chat/missing-renderer-warning.ts says so directly: "In chat it is almost always a mistake."

Every starter scaffolds app/markdown-renderer.tsx and wraps <Chat> in MarkdownRendererProvider (cli/templates/files/ai-agent/app/page.tsx). Both doc samples dropped that wrapper:

  • create-frontend.md said "Replace app/page.tsx" with a sample that has no provider — so the doc actively deleted working setup the reader already had, and never mentioned a renderer anywhere (0 hits for "markdown" in the whole page).
  • chat-ui.md's primary "Add the preset UI" sample also dropped it. The guide does have a "Render Markdown in chat" section, but it is ~280 lines below the sample with no pointer from it, so a reader copy-pasting the first block never reaches it.

Neither page's "Verify it worked" checklist had an item that would catch the degradation: create-frontend only checked that the response streams, and chat-ui's only Markdown item covered standalone <Markdown>, not chat answers. Both checklists passed on a visibly broken chat.

Fix

Minimal and doc-only:

  • Wrap both app/page.tsx samples in MarkdownRendererProvider, matching the scaffold.
  • Say why the wrapper is required, and note that the other samples on the chat-ui page need it too.
  • Give create-frontend a short "Supply the Markdown renderer" section for readers who added Veryfront to an existing project rather than scaffolding, with the exact-pinned parser install.
  • Add a verification item to both pages that fails when the answer renders as raw source.

No source or template changes — the framework and the scaffold were already correct; only the prose disagreed with them.

Regression test

tests/docs/guide-content.test.ts — "wires a Markdown renderer into every chat page the docs tell you to write".

It lives there because this is a doc-content contract, which is exactly what that suite holds (runtime floors, guide wording, CLI-flag accuracy), and because it is in the deno task docs:validate gate that CI already runs on every docs change. A code-level test could not catch it: the framework behaves correctly here — only the prose was wrong.

The test extracts the first // app/page.tsx fenced block from each page and requires the provider, the veryfront/markdown import, and the ./markdown-renderer.tsx import; it also requires each page to show how to create that file, and requires the "Verify it worked" section to check for rendered rather than raw Markdown.

Confirmed red before the fix, for the right reason, and independently for each page:

to contain: "MarkdownRendererProvider"
Expected actual: "// app/page.tsx ... return <Chat chat={chat} placeholder="Ask me anything..." />;"

Reverting only chat-ui.md reproduces the same failure on its own, so the test pins both halves rather than one.

Verification

  • deno task docs:validate passes end to end: 42 reference pages, 68 guides, 48 guide-example suites (94 steps), and all 1228 doc links — so the new #render-markdown-in-chat anchor and the cross-page link resolve.
  • deno fmt --check and deno lint clean on all three files.
  • Pre-existing, untouched: tests/docs/guide-examples.test.ts has 3 TS2532 errors under type-check; the docs:validate task runs that file with --no-check, and I did not modify it.

Related, deliberately not touched

MISSING_MARKDOWN_RENDERER_WARNING (src/react/components/chat/missing-renderer-warning.ts:29) points at https://veryfront.com/docs/guides/chat-ui#render-markdown-in-chat — missing the /code segment, so it 404s. That is a separate backlog finding owned by another agent; left alone here. The anchor half of it is now correct, since this PR keeps that heading and links to it.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3703b0ad-76cd-4d55-a985-f07999ef8a86

📥 Commits

Reviewing files that changed from the base of the PR and between 718355c and 1e2e11f.

📒 Files selected for processing (3)
  • docs/getting-started/create-frontend.md
  • docs/guides/chat-ui.md
  • tests/docs/guide-content.test.ts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2172b4e42e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/getting-started/create-frontend.md Outdated
Comment thread docs/guides/chat-ui.md Outdated
The chat page samples in create-frontend and chat-ui told the reader to
write an `app/page.tsx` that renders `<Chat>` with no Markdown renderer
installed. `veryfront/markdown` presents plain escaped source until a
renderer is supplied, so following either page verbatim produces a chat
that shows the assistant's raw Markdown and logs the framework's own
missing-renderer warning.

Every starter scaffolds `app/markdown-renderer.tsx` and the provider
around `<Chat>`, so "Replace app/page.tsx" actively removed working
setup the reader already had. Neither "Verify it worked" checklist had
an item that would notice.

Wrap both samples in `MarkdownRendererProvider`, explain why it is
required, show how to create the renderer in a project that was added to
rather than scaffolded, and add a verification item that fails when the
answer renders as raw source.
Review follow-up on two points, both correct:

- "Every starter scaffolds app/markdown-renderer.tsx" is false. The
  `minimal` and `agentic-workflow` templates ship without a renderer
  (only the chat starters under cli/templates/files/ carry the file), so
  a reader on either one copies a sample that imports a module they do
  not have. Name those two templates on both pages.
- `npm install react-markdown@9.0.3` records `^9.0.3`, contradicting the
  adjacent "pin to an exact version" requirement and letting the module
  pipeline resolve a later release. Add `--save-exact` to both copies of
  the command.
@kojiwakayama
kojiwakayama force-pushed the fix/dx-20260811-b2-1-2 branch from 2172b4e to 1e2e11f Compare August 11, 2026 09:58
@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit d984cf1 Aug 11, 2026
33 checks passed
@kojiwakayama
kojiwakayama deleted the fix/dx-20260811-b2-1-2 branch August 11, 2026 10:29
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.

1 participant