亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Remix中mdx?table不支持表格解決

 更新時間:2023年05月06日 10:51:53   作者:喬治_x  
這篇文章主要為大家介紹了Remix中mdx?table不支持表格問題解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪

remix 配置文件中配置 mdx 屬性

remix 中支持 md/mdx 語法,但是 Remix 語法沒有內(nèi)置對 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;

添加插件 remark-gfm

Remix 通過 remark 等支持 markdown 語法,但是默認沒有 表格等 gfm 插件支持。

npm install remark-gfm

添加配置:

/** @type {import('@remix-run/dev').AppConfig} */
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],
    };
  }
};

注意:經(jīng)過嘗試,使用 exports.mdx = async (filename) {/**/} 沒有生效。下面是支持之后的效果

以上就是Remix中mdx table不支持表格解決的詳細內(nèi)容,更多關(guān)于Remix mdx table不支持表格的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論