@mintlify/common 1.0.590 → 1.0.591

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.
@@ -1,4 +1,4 @@
1
- import { rehypeCodeBlocks, rehypeDynamicTailwindCss, rehypeMdxExtractEndpoint, rehypeMdxExtractExamples, rehypeParamFieldIds, rehypeRawComponents, rehypeUnicodeIds, rehypeZoomImages, remarkExtractChangelogFilters, remarkExtractTableOfContents, remarkFrames, remarkComponentIds, remarkMdxInjectSnippets, remarkMdxRemoveUnusedVariables, remarkRemoveImports, remarkMdxExtractPanel, remarkVideo, } from './plugins/index.js';
1
+ import { rehypeCodeBlocks, rehypeDynamicTailwindCss, rehypeMdxExtractEndpoint, rehypeMdxExtractExamples, rehypeParamFieldIds, rehypeRawComponents, rehypeTable, rehypeUnicodeIds, rehypeZoomImages, remarkExtractChangelogFilters, remarkExtractTableOfContents, remarkFrames, remarkComponentIds, remarkMdxInjectSnippets, remarkMdxRemoveUnusedVariables, remarkRemoveImports, remarkMdxExtractPanel, remarkVideo, } from './plugins/index.js';
2
2
  import { remarkMdxRemoveUnknownJsx } from './plugins/remark/remarkMdxRemoveUnknownJsx/index.js';
3
3
  import { remarkMermaid } from './plugins/remark/remarkMermaid.js';
4
4
  // avoid running extractors unnecessarily
@@ -30,6 +30,7 @@ export const getMDXOptions = ({ data, remarkPlugins = [], rehypePlugins = [], md
30
30
  rehypeCodeBlocks,
31
31
  rehypeParamFieldIds,
32
32
  ...rehypeExtractors(mdxExtracts, data),
33
+ rehypeTable,
33
34
  rehypeRawComponents,
34
35
  rehypeZoomImages,
35
36
  rehypeUnicodeIds,
@@ -3,6 +3,7 @@ export * from './rehypeMdxExtractEndpoint/index.js';
3
3
  export * from './rehypeMdxExtractExamples.js';
4
4
  export * from './rehypeParamFieldIds.js';
5
5
  export * from './rehypeRawComponents.js';
6
+ export * from './rehypeTable.js';
6
7
  export * from './rehypeZoomImages.js';
7
8
  export * from './rehypeUnicodeIds.js';
8
9
  export * from './rehypeDynamicTailwindCss.js';
@@ -3,6 +3,7 @@ export * from './rehypeMdxExtractEndpoint/index.js';
3
3
  export * from './rehypeMdxExtractExamples.js';
4
4
  export * from './rehypeParamFieldIds.js';
5
5
  export * from './rehypeRawComponents.js';
6
+ export * from './rehypeTable.js';
6
7
  export * from './rehypeZoomImages.js';
7
8
  export * from './rehypeUnicodeIds.js';
8
9
  export * from './rehypeDynamicTailwindCss.js';
@@ -0,0 +1,2 @@
1
+ import type { Pluggable } from 'unified';
2
+ export declare const rehypeTable: Pluggable;
@@ -0,0 +1,21 @@
1
+ import { u } from 'unist-builder';
2
+ import { visit } from 'unist-util-visit';
3
+ import { createMdxJsxAttribute } from '../../lib/remark-utils.js';
4
+ export const rehypeTable = () => {
5
+ return (tree) => {
6
+ visit(tree, 'element', (node, index, parent) => {
7
+ if (node.tagName === 'table' && parent && index !== undefined) {
8
+ const attributes = Object.entries(node.properties).map(([key, value]) => {
9
+ const attributeValue = Array.isArray(value) ? value.join(' ') : value;
10
+ const attributeName = key === 'class' ? 'className' : key;
11
+ return createMdxJsxAttribute(attributeName, attributeValue);
12
+ });
13
+ const tableComponent = u('mdxJsxFlowElement', {
14
+ name: 'Table',
15
+ attributes,
16
+ }, node.children);
17
+ parent.children.splice(index, 1, tableComponent);
18
+ }
19
+ });
20
+ };
21
+ };