@mintlify/common 1.0.733 → 1.0.735

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/slugify.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import { CountableSlugify } from '@sindresorhus/slugify';
2
+ export declare const cleanHeadingId: (id: string) => string;
2
3
  export declare function slugify(string: string, slugify?: CountableSlugify): string;
package/dist/slugify.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import { slugifyWithCounter } from '@sindresorhus/slugify';
2
2
  import { getUnicodeId } from './mdx/lib/remark-utils.js';
3
+ // decodes percent-encoded slugs and strips punctuation + emoji so the
4
+ // resulting ID matches what the client renders in the DOM
5
+ export const cleanHeadingId = (id) => {
6
+ const decoded = decodeURIComponent(id);
7
+ return decoded
8
+ .replace(/[?,;:!'"()[\]{}]/g, '')
9
+ .replace(/\p{Emoji_Modifier}|\p{Emoji_Modifier_Base}|\p{Emoji_Presentation}|\p{Extended_Pictographic}|[\u200D\uFE0E\uFE0F]/gu, '');
10
+ };
3
11
  export function slugify(string, slugify = slugifyWithCounter()) {
4
12
  const encodedString = getUnicodeId(string);
5
13
  // if encoded title is already percent-encoded, return it as is