Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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
There was a problem hiding this comment.
Pull Request Overview
This PR adds MDX image handling and remark plugins to support fumadocs functionality. The changes implement proper image processing for documentation by integrating fumadocs-core's MDX plugins and creating a custom image component.
- Added remarkImage plugin configuration to process external images
- Implemented custom MdxImage component to handle both Next.js Image optimization and fallback img elements
- Added new image domain allowlists for external image sources
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| next.config.mjs | Added remarkImage plugin configuration and external image domain allowlists |
| mdx-components.tsx | Implemented custom MdxImage component with Next.js Image optimization |
| app/docs/ai/MoE/moe-update.md | Added new documentation content about MoE theory |
Files not reviewed (1)
- .idea/workspace.xml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return ( | ||
| <img | ||
| src={src as string} | ||
| alt={alt} | ||
| width={width} | ||
| height={height} | ||
| {...rest} | ||
| /> | ||
| ); |
There was a problem hiding this comment.
The logic is inverted. When src is falsy, the code renders an img element with src={src as string}, which will result in an empty or undefined src attribute. The condition should be if (!src) with an early return or error handling, not rendering an img with the falsy src value.
| return ( | |
| <img | |
| src={src as string} | |
| alt={alt} | |
| width={width} | |
| height={height} | |
| {...rest} | |
| /> | |
| ); | |
| return null; |
| width={numericWidth} | ||
| height={numericHeight} |
There was a problem hiding this comment.
The Next.js Image component requires both width and height to be defined numbers when using static imports or external URLs. If either numericWidth or numericHeight is undefined or NaN after conversion, this will cause a runtime error. Add validation to ensure both values are valid numbers before passing to the Image component.
next.config.mjs
Outdated
There was a problem hiding this comment.
[nitpick] The wildcard pattern pub-*.r2.dev may be too permissive for security purposes. Consider using more specific hostnames or implementing additional validation to ensure only trusted R2 buckets are allowed.
| { protocol: "https", hostname: "pub-*.r2.dev", pathname: "/**" }, | |
| // Only allow specific trusted R2 buckets: | |
| { protocol: "https", hostname: "pub-myproject.r2.dev", pathname: "/**" }, | |
| // Add more trusted hostnames as needed, e.g.: | |
| // { protocol: "https", hostname: "pub-assets.r2.dev", pathname: "/**" }, |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- .idea/workspace.xml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| if (!Number.isFinite(numericWidth) || !Number.isFinite(numericHeight)) { | ||
| // fallback: 当 width/height 不是可解析数值时,直接使用原生 <img> | ||
| return <img src={src ?? ""} alt={alt ?? ""} {...rest} />; |
There was a problem hiding this comment.
The condition checks if either width or height is not finite, but the fallback doesn't pass the width and height props to the img element. This could result in missing dimensions that were intended to be applied.
| return <img src={src ?? ""} alt={alt ?? ""} {...rest} />; | |
| return <img src={src ?? ""} alt={alt ?? ""} width={width} height={height} {...rest} />; |
next.config.mjs
Outdated
There was a problem hiding this comment.
The wildcard pattern 'pub-*.r2.dev' for hostname may not work as expected in Next.js image configuration. Consider using a more specific hostname or verify that this wildcard pattern is supported by Next.js remotePatterns.
| { protocol: "https", hostname: "pub-*.r2.dev", pathname: "/**" }, |
No description provided.