-
Notifications
You must be signed in to change notification settings - Fork 146
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
[Feature]: render unsupported files refs as links to the repo #1792
Comments
Rspress does not support using pdf/ppt files in If you want to render pdf and ppt files or generate a download link for them, you'd better write some components to customize the rendering logic based on mdx or tsx files. Also, you can use custom-link type in |
The link to the PDF or another document is included in the markdown file rather than {
"downloadURL": "https://github.com/web-infra-dev/rspress/files"
} With this setup, the reference URL would be generated as a normal link if the file isn’t supported otherwise. |
What I meant above is you should write a React component which can be named import React from 'react';
interface DownloadLinkProps {
pdfUrl: string;
fileName: string;
}
const DownloadLink: React.FC<DownloadLinkProps> = ({ pdfUrl, fileName }) => {
// ... download logic
return (
<a href="#">
{fileName}
</a>
);
};
export default DownloadLink; import DownloadLink from './DownloadLink';
<DownloadLink pdfUrl="https://example.com/my-pdf.pdf" fileName="my-pdf.pdf" /> Regarding the hosting and deployment of static resources, PDF or another document can be copied to output folder after Rspress build, thus you can handle these yourself. |
That is sold answer, but I don't want to use mdx, I want to use md files instead as we have rspress as step to improve our github docs repo so I want to keep both working at same time until we fully migrate to rspress |
Yeah, what I give is a temporary solution. The future solution strategy is to support preview of
|
What problem does this feature solve?
when referencing files that is not supported like PDF or Power point I think the best is to have a link so you can download it instead of 404 page
What does the proposed API look like?
files which is not supported can be downloadable link
The text was updated successfully, but these errors were encountered: