gatsby-plugin-mdx上标和下标支持

问题描述 投票:1回答:1

我在使<sup><sub>之类的HTML元素与gatsby-plugin-mdx一起使用时遇到麻烦。

我在gatsby-plugin-mdx文档中找到了以下代码。您可以将本地注释插件添加到gatsby-plugin-mdx,如下所示:

https://www.gatsbyjs.org/packages/gatsby-plugin-mdx/#md-plugins

module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-mdx`,
      options: {
        remarkPlugins: [require("remark-abbr")],
      },
    },
  ],
}

沿着这些行,我向项目添加了remark-sub-super并将其放入我的gatsby-config中,如下所示:

const remarkSubSuper = require('remark-sub-super');
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-mdx`,
      options: {
        extensions: [`.mdx`, `.md`],
        remarkPlugins: [remarkSubSuper],
    },
  ],
}

尽管如此,我仍然看到一些错误,它们似乎与<sup><sub>标签有关。

"gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:

unknown: Unterminated JSX contents (17:16)

  15 | <em><sup>1 </sup>https://example.com/</em>
  16 | <em><sup>2 </sup>https://example.com/</em>
> 17 |     </MDXLayout>
     |                 ^
  18 |   )
  19 | };
  20 | MDXContent.isMDXComponent = true/<PATH>: unknown: Unterminated JSX contents (17:16)

  15 | <em><sup>1 </sup>https://example.com/</em>
  16 | <em><sup>2 </sup>https://example.com/</em>
> 17 |     </MDXLayout>
     |                 ^
  18 |   )
  19 | };
  20 | MDXContent.isMDXComponent = true

某些版本信息:

"gatsby": "^2.19.18",
"gatsby-plugin-mdx": "^1.0.73",
"remark-sub-super": "^1.0.19",

有人对我在这里做错什么有想法吗?

gatsby
1个回答
0
投票

问题的确是将HTML的格式提供给gatsby-plugin-mdx

© www.soinside.com 2019 - 2024. All rights reserved.