目录remix 配置文件中配置 mdx 属性添加插件 remark-gfmremix 配置文件中配置 mdx 属性 remix 中支持 md/mdx 语法,但是 Remix 语法没有
remix 中支持 md/mdx 语法,但是 Remix 语法没有内置对 markdown 表格的支持。
mdx 配置在 Remix 文档很不明显,从 remix 的配置文件的 .d.ts
文件。
export interface AppConfig {
mdx?: RemixMdxConfig | RemixMdxConfigFunction;
}
export interface RemixMdxConfig {
rehypePlugins?: any[];
remarkPlugins?: any[];
}
export type RemixMdxConfigFunction = (filename: string) => Promise<RemixMdxConfig | undefined> | RemixMdxConfig | undefined;
Remix 通过 remark 等支持 markdown 语法,但是默认没有 表格等 gfm 插件支持。
npm install remark-gfm
添加配置:
module.exports = {
// ...
mdx: async (filename) => {
const [rehypeHighlight, remarkToc, gfm] = await Promise.all([
import("rehype-highlight").then((mod) => mod.default),
import("remark-toc").then((mod) => mod.default),
import("remark-gfm").then((mod) => mod.default),
]);
return {
remarkPlugins: [remarkToc, gfm],
rehypePlugins: [rehypeHighlight],
};
}
};
注意:经过尝试,使用 exports.mdx = async (filename) {}
没有生效。下面是支持之后的效果
以上就是Remix中mdx table不支持表格解决的详细内容,更多关于Remix mdx table不支持表格的资料请关注编程网其它相关文章!
--结束END--
本文标题: Remix中mdx table不支持表格解决
本文链接: https://www.lsjlt.com/news/212574.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-12
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0