0.3.1 • Published 2 years ago

@gatsby-project-kb/transformer-wiki-references v0.3.1

Weekly downloads
143
License
MIT
Repository
github
Last release
2 years ago

@gatsby-project-kb/transformer-wiki-references

A gatsby transformer plugin to extract references between markdown nodes. You can then use them to create bi-directional links.

Forked from mathieudutour/gatsby-digital-garden.

An example site for using this plugin is at https://wiki.hikerpig.cn/.

Install

yarn add @gatsby-project-kb/transformer-wiki-references

Usage

// In your gatsby-config.js
module.exports = {
  plugins: [
    // after a markdown or Mdx transformer
    {
      resolve: `@gatsby-project-kb/transformer-wiki-references`,
      options: {
        contentPath: '/home/hikerpig/Notes',
        types: ["Mdx"], // or ["MarkdownRemark"] (or both)
        ignore: [
          '**/.cache/**',
          '**/.github/**',
        ],
      },
    },
  ],
};

Configuration options

contentPath string

The path to directory of your notes, if there are nested folders in your notes, it's recommended that this option is provided so the plugin can resolve the references correctly.

types Array

The types of the nodes to transform. Defaults to ['Mdx']

ignore Array

Will be used along with contentPath, to filter out those files you want to ignore. Accepts globs or regexps, any format that's supported by anymatch.

How to query for references

Two types of references are available: outboundReferences and inboundReferences.

The fields will be created in your site's GraphQL schema on the nodes of types specified in the options.

{
  allMdx {
    outboundReferences {
      ... on Mdx {
        id
        parent {
          id
        }
      }
    }
    inboundReferences {
      ... on Mdx {
        id
        parent {
          id
          ... on RoamPage {
            title
          }
        }
      }
    }
  }
}
0.3.1

2 years ago

0.3.0

3 years ago

0.3.0-alpha.2

3 years ago

0.3.0-alpha.1

3 years ago

0.3.0-alpha.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago