@mintlify/common 1.0.1034 → 1.0.1036

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ export * from './remarkValidateAccordions.js';
18
18
  export * from './remarkValidateSteps.js';
19
19
  export * from './remarkValidateVisibility.js';
20
20
  export * from './remarkValidateTabs.js';
21
+ export * from './remarkValidateApiExamples.js';
21
22
  export * from './remarkVideo.js';
22
23
  export * from './remarkExtractMultiView.js';
23
24
  export * from './remarkPrompt.js';
@@ -18,6 +18,7 @@ export * from './remarkValidateAccordions.js';
18
18
  export * from './remarkValidateSteps.js';
19
19
  export * from './remarkValidateVisibility.js';
20
20
  export * from './remarkValidateTabs.js';
21
+ export * from './remarkValidateApiExamples.js';
21
22
  export * from './remarkVideo.js';
22
23
  export * from './remarkExtractMultiView.js';
23
24
  export * from './remarkPrompt.js';
@@ -0,0 +1,2 @@
1
+ import type { Root } from 'mdast';
2
+ export declare const remarkValidateApiExamples: () => (tree: Root) => void;
@@ -0,0 +1,15 @@
1
+ import { visit } from 'unist-util-visit';
2
+ export const remarkValidateApiExamples = () => (tree) => {
3
+ const counts = { RequestExample: 0, ResponseExample: 0 };
4
+ visit(tree, 'mdxJsxFlowElement', (node) => {
5
+ if (node.name === 'RequestExample' || node.name === 'ResponseExample') {
6
+ counts[node.name] += 1;
7
+ }
8
+ });
9
+ if (counts.RequestExample > 1) {
10
+ console.warn('Only one <RequestExample> is supported per page.');
11
+ }
12
+ if (counts.ResponseExample > 1) {
13
+ console.warn('Only one <ResponseExample> is supported per page.');
14
+ }
15
+ };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { serialize } from '@mintlify/mdx/server';
11
11
  import { getTailwindSelectors } from '../../css/tailwind.js';
12
- import { getMDXOptions, remarkMdxRemoveJs, remarkExpandContent, remarkSplitCodeGroup, remarkSplitTabs, remarkValidateAccordions, remarkValidateSteps, remarkValidateVisibility, remarkValidateTabs, } from '../../index.js';
12
+ import { getMDXOptions, remarkMdxRemoveJs, remarkExpandContent, remarkSplitCodeGroup, remarkSplitTabs, remarkValidateAccordions, remarkValidateSteps, remarkValidateVisibility, remarkValidateTabs, remarkValidateApiExamples, } from '../../index.js';
13
13
  import { codeStylingToThemeOrThemes } from '../getCodeStyling.js';
14
14
  import { preprocessCustomHeadingIds } from '../preprocessCustomHeadingIds.js';
15
15
  import { replaceVariables } from '../replaceVariables.js';
@@ -37,6 +37,7 @@ export function getMdx(_a) {
37
37
  remarkValidateTabs,
38
38
  remarkValidateVisibility,
39
39
  remarkValidateAccordions,
40
+ remarkValidateApiExamples,
40
41
  ...remarkPlugins,
41
42
  ];
42
43
  if (pageType === 'pdf') {