@adobe/gatsby-remark-afm 中文文档教程

发布于 3 年前 浏览 2 项目主页 更新于 2 年前

gatsby-remark-afm

使用 Adob​​e扩展增强 github 风格的降价

Important

之前 gatsby-remark-external-links

Installation

npm add @adobe/gatsby-remark-afm

Usage

此插件可以与 gatsby-transformer-remarkgatsby-plugin-mdx

要将它与 gatsby-transformer-remark 一起使用,请将它添加到您的 gatsby-config.js 中,如下所示:

plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        {
          resolve: `@adobe/gatsby-remark-afm`,
          options: {
            directory: `${__dirname}/path-to-markdown-files`,
          },
        },
        'gatsby-remark-external-links',
      ]
    }
  },

要将它与 gatsby-plugin-mdx,将其添加到您的 gatsby-config.js 中,如下所示:

{
  resolve: `gatsby-plugin-mdx`,
  options: {
    extensions: [`.mdx`, `.md`],
    gatsbyRemarkPlugins: [
      {
        resolve: `@adobe/gatsby-remark-afm`,
        options: {
          directory: `${__dirname}/path-to-markdown-files`,
        },
      },
    ],
  },
},

Options

directory - 保存站点 markdown 文件的目录的绝对路径。

此选项是解析插件的包含功能 {% include_relative path/to/markdown-file.md %} 所必需的,它允许作者将一个 markdown 文件的内容包含到另一个文件中。

添加此目录路径可确保插件可以找到要包含的站点的降价文件。 directory 路径的子目录中的所有 markdown 文件也将根据需要进行处理和提供。

License

Apache-2.0

Contributing

欢迎贡献! 阅读贡献指南了解更多信息。

gatsby-remark-afm

Enhances github flavoured markdown with Adobe extensions

Important

Use this before gatsby-remark-external-links

Installation

npm add @adobe/gatsby-remark-afm

Usage

This plugin can be used with gatsby-transformer-remark or gatsby-plugin-mdx.

To use it with gatsby-transformer-remark, add it to your gatsby-config.js like this:

plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        {
          resolve: `@adobe/gatsby-remark-afm`,
          options: {
            directory: `${__dirname}/path-to-markdown-files`,
          },
        },
        'gatsby-remark-external-links',
      ]
    }
  },

To use it with gatsby-plugin-mdx, add it to your gatsby-config.js like this:

{
  resolve: `gatsby-plugin-mdx`,
  options: {
    extensions: [`.mdx`, `.md`],
    gatsbyRemarkPlugins: [
      {
        resolve: `@adobe/gatsby-remark-afm`,
        options: {
          directory: `${__dirname}/path-to-markdown-files`,
        },
      },
    ],
  },
},

Options

directory - The absolute path to the directory where you keep your markdown files for your site.

This option is required to resolve the plugin's include feature {% include_relative path/to/markdown-file.md %}, which allows writers to include the contents from one markdown file into another.

Adding this directory path ensures that the plugin can find your site's markdown files to include. All markdown files in sub-directories of the directory path will also be processed and made available as needed.

License

Apache-2.0

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文