@mintlify/common 1.0.1211 → 1.0.1213
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.
- package/dist/mdx/plugins/remark/index.d.ts +1 -0
- package/dist/mdx/plugins/remark/index.js +1 -0
- package/dist/mdx/plugins/remark/remarkWrapCodeBlocks.d.ts +2 -0
- package/dist/mdx/plugins/remark/remarkWrapCodeBlocks.js +9 -0
- package/dist/mdx/server-only/getMdx.js +8 -2
- package/dist/rss/index.d.ts +1 -0
- package/dist/rss/index.js +21 -3
- package/dist/rss/processUpdateNode.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -14,6 +14,7 @@ export * from './remarkMdxRemoveJs.js';
|
|
|
14
14
|
export * from './remarkExtractChangelogFilters.js';
|
|
15
15
|
export * from './remarkExpandContent.js';
|
|
16
16
|
export * from './remarkSplitCodeGroup.js';
|
|
17
|
+
export * from './remarkWrapCodeBlocks.js';
|
|
17
18
|
export * from './remarkSplitTabs.js';
|
|
18
19
|
export * from './remarkComponentIds.js';
|
|
19
20
|
export * from './remarkMdxExtractPanel.js';
|
|
@@ -14,6 +14,7 @@ export * from './remarkMdxRemoveJs.js';
|
|
|
14
14
|
export * from './remarkExtractChangelogFilters.js';
|
|
15
15
|
export * from './remarkExpandContent.js';
|
|
16
16
|
export * from './remarkSplitCodeGroup.js';
|
|
17
|
+
export * from './remarkWrapCodeBlocks.js';
|
|
17
18
|
export * from './remarkSplitTabs.js';
|
|
18
19
|
export * from './remarkComponentIds.js';
|
|
19
20
|
export * from './remarkMdxExtractPanel.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { visit } from 'unist-util-visit';
|
|
2
|
+
import { parseMetaString } from '../rehype/rehypeCodeBlocks/parseMetaString.js';
|
|
3
|
+
export const remarkWrapCodeBlocks = () => (tree) => {
|
|
4
|
+
visit(tree, 'code', (node) => {
|
|
5
|
+
if (node.meta && parseMetaString(node.meta).wrap === true)
|
|
6
|
+
return;
|
|
7
|
+
node.meta = node.meta ? `${node.meta} wrap` : 'wrap';
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -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, remarkValidateApiExamples, } from '../../index.js';
|
|
12
|
+
import { getMDXOptions, remarkMdxRemoveJs, remarkExpandContent, remarkSplitCodeGroup, remarkSplitTabs, remarkWrapCodeBlocks, 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 { preprocessMdxFragmentCode } from '../preprocessMdxFragmentCode.js';
|
|
@@ -43,7 +43,13 @@ export function getMdx(_a) {
|
|
|
43
43
|
...remarkPlugins,
|
|
44
44
|
];
|
|
45
45
|
if (pageType === 'pdf') {
|
|
46
|
-
plugins = [
|
|
46
|
+
plugins = [
|
|
47
|
+
...plugins,
|
|
48
|
+
remarkExpandContent,
|
|
49
|
+
remarkSplitCodeGroup,
|
|
50
|
+
remarkSplitTabs,
|
|
51
|
+
remarkWrapCodeBlocks,
|
|
52
|
+
];
|
|
47
53
|
}
|
|
48
54
|
const syntaxHighlightingOptions = Object.assign(Object.assign({}, codeStylingToThemeOrThemes(codeStyling)), { customLanguages });
|
|
49
55
|
// detector sits exactly where remarkMdxRemoveJs sits in the no-js pass, so it
|
package/dist/rss/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const getTags: (node: UpdateMDXComponent) => string[] | undefined
|
|
|
11
11
|
export declare const getRssPropsData: (updateComponent: UpdateMDXComponent) => {
|
|
12
12
|
rssTitle: string | undefined;
|
|
13
13
|
rssDescription: string | undefined;
|
|
14
|
+
rssDate: string | undefined;
|
|
14
15
|
};
|
|
15
16
|
export declare const getUpdateTitle: (updateComponent: UpdateMDXComponent) => string | undefined;
|
|
16
17
|
export declare const getUpdateDescription: (updateComponent: UpdateMDXComponent) => string | undefined;
|
package/dist/rss/index.js
CHANGED
|
@@ -84,7 +84,25 @@ export const getRssPropsData = (updateComponent) => {
|
|
|
84
84
|
const rssData = attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'rss');
|
|
85
85
|
const title = getObjectExpressionStringProperty('title', rssData);
|
|
86
86
|
const description = getObjectExpressionStringProperty('description', rssData);
|
|
87
|
-
|
|
87
|
+
const date = parseRssDate(getObjectExpressionStringProperty('date', rssData));
|
|
88
|
+
return { rssTitle: title, rssDescription: description, rssDate: date };
|
|
89
|
+
};
|
|
90
|
+
const parseRssDate = (value) => {
|
|
91
|
+
if (!value)
|
|
92
|
+
return undefined;
|
|
93
|
+
const parsedDate = new Date(value);
|
|
94
|
+
if (isNaN(parsedDate.getTime()))
|
|
95
|
+
return undefined;
|
|
96
|
+
const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})/.exec(value);
|
|
97
|
+
if (isoDateMatch && !isValidCalendarDate(isoDateMatch))
|
|
98
|
+
return undefined;
|
|
99
|
+
return parsedDate.toISOString();
|
|
100
|
+
};
|
|
101
|
+
const isValidCalendarDate = ([, year, month, day]) => {
|
|
102
|
+
const date = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
|
103
|
+
return (date.getUTCFullYear() === Number(year) &&
|
|
104
|
+
date.getUTCMonth() === Number(month) - 1 &&
|
|
105
|
+
date.getUTCDate() === Number(day));
|
|
88
106
|
};
|
|
89
107
|
const getUpdateAnchorId = (updateComponent) => {
|
|
90
108
|
const idAttribute = updateComponent.attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' &&
|
|
@@ -379,11 +397,11 @@ export const containsMarkdownHeading = (updateNode, title) => {
|
|
|
379
397
|
// soon to be deprecated, use processUpdateNode.ts instead
|
|
380
398
|
export const processUpdateNode = ({ updateNode, date, }) => {
|
|
381
399
|
const updates = [];
|
|
382
|
-
const
|
|
400
|
+
const { rssTitle, rssDescription, rssDate } = getRssPropsData(updateNode);
|
|
401
|
+
const nowOrOldDate = rssDate || date || new Date().toISOString();
|
|
383
402
|
const containsRss = containsRssProps(updateNode);
|
|
384
403
|
const containsMarkdown = containsMarkdownGroups(updateNode);
|
|
385
404
|
if (containsRss) {
|
|
386
|
-
const { rssTitle, rssDescription } = getRssPropsData(updateNode);
|
|
387
405
|
const newUpdates = processUpdatePerNode({
|
|
388
406
|
updateNode,
|
|
389
407
|
date: nowOrOldDate,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getRssPropsData, processUpdatePerNode } from './index.js';
|
|
2
2
|
export const processUpdateNode = ({ updateNode, date, }) => {
|
|
3
|
-
const { rssTitle, rssDescription } = getRssPropsData(updateNode);
|
|
3
|
+
const { rssTitle, rssDescription, rssDate } = getRssPropsData(updateNode);
|
|
4
4
|
return processUpdatePerNode({
|
|
5
5
|
updateNode,
|
|
6
|
-
date,
|
|
6
|
+
date: rssDate || date,
|
|
7
7
|
title: rssTitle,
|
|
8
8
|
description: rssDescription,
|
|
9
9
|
});
|