@mintlify/common
Version:
Commonly shared code within Mintlify
50 lines (49 loc) • 2.51 kB
JavaScript
import { rehypeCodeBlocks, rehypeDynamicTailwindCss, rehypeKeyboardSymbols, rehypeListItemText, rehypeMdxExtractEndpoint, rehypeMdxExtractExamples, rehypeParamFieldIds, rehypeRawComponents, rehypeTable, rehypeUnicodeIds, rehypeZoomImages, remarkExtractChangelogFilters, remarkExtractTableOfContents, remarkFrames, remarkComponentIds, remarkMdxInjectSnippets, remarkMdxRemoveUnusedVariables, remarkRemoveImports, remarkMdxExtractPanel, remarkResolveRelativeLinks, remarkVideo, remarkMdxClientComponentBoundaries, remarkExtractMultiView, remarkPrompt, remarkUnwrapJsxHeadings, } from './plugins/index.js';
import { remarkMdxRemoveUnknownJsx } from './plugins/remark/remarkMdxRemoveUnknownJsx/index.js';
import { remarkMermaid } from './plugins/remark/remarkMermaid.js';
// avoid running extractors unnecessarily
const rehypeExtractors = (mdxExtracts, data) => {
if (!mdxExtracts)
return [];
return [
[],
[],
];
};
export const getMDXOptions = ({ data, remarkPlugins = [], rehypePlugins = [], mdxExtracts, allowedComponents = [], }) => {
return {
remarkPlugins: [
[],
[],
remarkPrompt,
[],
remarkUnwrapJsxHeadings,
[], // modifies tree so cannot be excluded
[],
[],
[],
remarkMdxRemoveUnusedVariables,
remarkFrames,
remarkRemoveImports,
remarkMermaid,
remarkVideo,
...remarkPlugins,
[],
remarkMdxClientComponentBoundaries,
],
rehypePlugins: [
rehypeCodeBlocks,
rehypeKeyboardSymbols,
rehypeParamFieldIds,
...rehypeExtractors(mdxExtracts, data),
rehypeTable,
rehypeRawComponents,
rehypeListItemText,
rehypeZoomImages,
rehypeUnicodeIds,
[],
...rehypePlugins,
],
format: 'mdx',
};
};