@commercetools-docs/gatsby-theme-api-docs
Version:
Gatsby theme for commercetools documentation API
41 lines (36 loc) • 1.01 kB
JavaScript
import path from "path";
const getTagListOption = (themeOptions) => {
if (!themeOptions.transformerMdx) return [];
return (
themeOptions.transformerMdx.tagList ||
// backwards compatibility
themeOptions.transformerMdx.tagWhitelist
);
};
const config = (themeOptions = {}) => {
// Extract the `tagList` from the theme options if specified
const additionalTags = getTagListOption(themeOptions);
return {
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'api-specs',
path: path.resolve('./src/api-specs'),
},
},
{
resolve: '@commercetools-docs/gatsby-transformer-mdx-introspection',
options: {
...themeOptions.transformerMdx,
tagList: ['ApiType', 'ApiEndpoint', ...additionalTags],
},
},
{
resolve: '@commercetools-docs/gatsby-transformer-raml',
options: themeOptions.transformerRaml,
},
],
};
};
export default config;