-
Notifications
You must be signed in to change notification settings - Fork 39
fix: add remark funmadocs #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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.
ℹ️ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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} | ||
| /> | ||
| ); |
Copilot
AI
Oct 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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} |
Copilot
AI
Oct 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| pathname: "/**", | ||
| }, | ||
| { protocol: "https", hostname: "img.coly.cc", pathname: "/**" }, | ||
| { protocol: "https", hostname: "pub-*.r2.dev", pathname: "/**" }, |
Copilot
AI
Oct 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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: "/**" }, |
TSK-Glofy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preview格式正确
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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} />; |
Copilot
AI
Oct 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| pathname: "/**", | ||
| }, | ||
| { protocol: "https", hostname: "img.coly.cc", pathname: "/**" }, | ||
| { protocol: "https", hostname: "pub-*.r2.dev", pathname: "/**" }, |
Copilot
AI
Oct 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.