Skip to content

Comments

Add missing imports in markdown guide#6628

Open
josefbender wants to merge 6 commits intoTanStack:mainfrom
josefbender:patch-3
Open

Add missing imports in markdown guide#6628
josefbender wants to merge 6 commits intoTanStack:mainfrom
josefbender:patch-3

Conversation

@josefbender
Copy link
Contributor

@josefbender josefbender commented Feb 10, 2026

Summary by CodeRabbit

  • Documentation
    • Updated markdown rendering guide with asynchronous rendering, improved internal link routing, and image lazy-loading for better performance.
  • New Features
    • Markdown component now accepts an optional className prop for easier styling.
  • Chores
    • Content schema updated: post metadata now uses a date-typed published field for more accurate date handling.

@github-actions github-actions bot added the documentation Everything documentation related label Feb 10, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Updated the Markdown rendering pipeline and public API: parser import expanded to include domToReact/Element, Markdown component now renders asynchronously with loading state and optional className, internal links route via Link, images use lazy loading, import paths adjusted, and content-collections schema switched to z.object with date type.

Changes

Cohort / File(s) Summary
Docs guide
docs/start/framework/react/guide/rendering-markdown.md
Updated guide to show async Markdown rendering with useState/useEffect, loading state, internal Link routing for relative anchors, and lazy-loaded images.
Markdown component
src/components/Markdown.tsx
Component signature extended to accept optional className?: string; now renders markdown asynchronously and shows a Loading state.
Markdown lib & imports
src/lib/markdown.ts, src/components/..., docs/... (imports)
Changed import path from ~/utils/markdown to @/lib/markdown; html-react-parser import expanded to include domToReact and Element; added React hooks and Link imports where used.
Content schema
src/content-collections.tsx
Switched schema from a function-returned object to z.object({...}) and changed published field to a date() type (Zod).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User as Client (Browser)
participant MDComp as Markdown Component
participant Parser as html-react-parser
participant Router as Link/Router
participant Content as Content Source
rect rgba(200,220,255,0.5)
User->>MDComp: Navigate / request page
MDComp->>Content: load/receive markdown (async)
Content-->>MDComp: markdown text
MDComp->>Parser: parse markdown -> AST (domToReact)
Parser-->>MDComp: React nodes (images, links, elements)
MDComp->>Router: wrap internal anchors with Link
MDComp-->>User: render React tree (or Loading while awaiting)
end

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibble text and stitch each link,
Async I render, pause to think,
Lazy images blink, then show,
Internal paths hop where they go,
A tiny rabbit builds your flow. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'missing imports' but the changeset includes multiple substantial changes beyond imports: component API modifications, rendering pipeline updates, async behavior changes, and schema configuration changes. Revise the title to reflect the primary changes, such as 'Update markdown rendering with async support and component enhancements' or a more accurate description of the main modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 10, 2026

View your CI Pipeline Execution ↗ for commit 7f0d487

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 3s View ↗
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-10 11:19:13 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 10, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6628

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6628

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6628

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6628

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6628

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6628

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6628

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6628

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6628

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6628

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6628

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6628

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6628

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6628

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6628

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6628

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6628

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6628

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6628

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6628

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6628

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6628

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6628

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6628

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6628

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6628

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6628

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6628

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6628

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6628

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6628

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6628

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6628

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6628

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6628

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6628

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6628

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6628

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6628

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6628

commit: 7f0d487

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/start/framework/react/guide/rendering-markdown.md`:
- Around line 89-92: The import list for html-react-parser is missing domToReact
which causes a runtime ReferenceError when internal links are rendered; update
the import statement that currently imports parse, HTMLReactParserOptions, and
Element to also import domToReact from 'html-react-parser' so the domToReact
function used later (around the internal link rendering logic) is defined and
available.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/start/framework/react/guide/rendering-markdown.md (1)

23-24: ⚠️ Potential issue | 🟡 Minor

Align the markdown utility file path with its import.

The guide says to create src/utils/markdown.ts, but the component imports from @/lib/markdown. Please make these consistent to avoid reader confusion.

Suggested doc fix
-// src/utils/markdown.ts
+// src/lib/markdown.ts

Also applies to: 94-95

🤖 Fix all issues with AI agents
In `@docs/start/framework/react/guide/rendering-markdown.md`:
- Around line 176-179: The schema's published field uses z.date() which rejects
YAML/frontmatter date strings produced by gray-matter; update the schema in the
z.object (the fields title, published, description) to coerce strings to dates
by replacing published: z.date() with published: z.coerce.date(), or for
stricter ISO validation use published:
z.string().datetime().pipe(z.coerce.date()); ensure the transform/validator that
reads frontmatter uses the updated schema so string dates are accepted and
converted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Everything documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants