@mintlify/common 1.0.382 → 1.0.384
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/isAbsoluteUrl.d.ts +6 -0
- package/dist/isAbsoluteUrl.js +15 -0
- package/dist/mdx/plugins/rehype/rehypeMdxExtractEndpoint/parsers.js +1 -1
- package/dist/mdx/plugins/remark/remarkHeadingIds.js +2 -1
- package/dist/mdx/plugins/remark/remarkReplaceAllImages.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a URL is absolute
|
|
3
|
+
* @param url - The URL to check
|
|
4
|
+
* @returns True if the URL is absolute, false otherwise
|
|
5
|
+
*/
|
|
6
|
+
export const isAbsoluteUrl = (url) => {
|
|
7
|
+
if (!url || typeof url !== 'string')
|
|
8
|
+
return false;
|
|
9
|
+
try {
|
|
10
|
+
return URL.canParse(url);
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import isAbsoluteUrl from 'is-absolute-url';
|
|
2
1
|
import { getSecurityOptionsForAuthMethod } from '../../../../index.js';
|
|
2
|
+
import { isAbsoluteUrl } from '../../../../isAbsoluteUrl.js';
|
|
3
3
|
import { isDocsConfig } from '../../../../isDocsConfig.js';
|
|
4
4
|
import { isMdxJsxAttribute, isParamFieldLocation } from '../../../lib/mdx-utils.js';
|
|
5
5
|
export const parseApiString = (apiString, config) => {
|
|
@@ -4,7 +4,7 @@ import { createMdxJsxAttribute, getUnicodeId } from '../../lib/remark-utils.js';
|
|
|
4
4
|
import { getTOCTitle } from '../../lib/remark-utils.js';
|
|
5
5
|
export const remarkHeadingIds = () => (tree) => {
|
|
6
6
|
const slugify = slugifyWithCounter();
|
|
7
|
-
visit(tree, 'heading', (node) => {
|
|
7
|
+
visit(tree, 'heading', (node, _, parent) => {
|
|
8
8
|
if ([1, 2, 3, 4].includes(node.depth)) {
|
|
9
9
|
const title = getTOCTitle(node);
|
|
10
10
|
const encodedTitle = getUnicodeId(title);
|
|
@@ -24,6 +24,7 @@ export const remarkHeadingIds = () => (tree) => {
|
|
|
24
24
|
const mdxJsxAttributes = [
|
|
25
25
|
createMdxJsxAttribute('level', node.depth),
|
|
26
26
|
createMdxJsxAttribute('id', slug),
|
|
27
|
+
createMdxJsxAttribute('isAtRootLevel', (parent === null || parent === void 0 ? void 0 : parent.type) === 'root'),
|
|
27
28
|
];
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
node.attributes = mdxJsxAttributes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import isAbsoluteUrl from 'is-absolute-url';
|
|
2
1
|
import path from 'path';
|
|
3
2
|
import { visit } from 'unist-util-visit';
|
|
4
3
|
import { removeBasePath } from '../../../fs/removeBasePath.js';
|
|
4
|
+
import { isAbsoluteUrl } from '../../../isAbsoluteUrl.js';
|
|
5
5
|
import { getS3URI } from '../../../services/aws.js';
|
|
6
6
|
export const getImageUri = (imagePath, subdomain, filePath, basePath, opts = {}) => {
|
|
7
7
|
if (imagePath.startsWith('/')) {
|