diff --git a/packages/documentation/.storybook/main.ts b/packages/documentation/.storybook/main.ts index 33c587f07e..7eab581511 100644 --- a/packages/documentation/.storybook/main.ts +++ b/packages/documentation/.storybook/main.ts @@ -1,6 +1,7 @@ import type { StorybookConfig } from '@storybook/web-components-vite'; import pkg from '@/../package.json'; import { mergeConfig } from 'vite'; +import rehypeSlug from 'rehype-slug'; import rehypeAutolinkHeadings from 'rehype-autolink-headings'; const config: StorybookConfig = { @@ -30,6 +31,7 @@ const config: StorybookConfig = { mdxPluginOptions: { mdxCompileOptions: { rehypePlugins: [ + rehypeSlug, [ rehypeAutolinkHeadings, { diff --git a/packages/documentation/package.json b/packages/documentation/package.json index 8203dfcea3..00ce93ca73 100644 --- a/packages/documentation/package.json +++ b/packages/documentation/package.json @@ -74,8 +74,8 @@ "react": "18.3.1", "react-dom": "18.3.1", "react-syntax-highlighter": "15.5.0", - "rehype-autolink-headings": "^7.1.0", - "remark-autolink-headings": "7.0.1", + "rehype-autolink-headings": "7.1.0", + "rehype-slug": "6.0.0", "rimraf": "6.0.1", "sass": "1.77.6", "storybook": "8.1.11", diff --git a/packages/documentation/public/assets/scripts/autolink.js b/packages/documentation/public/assets/scripts/autolink.js index a092b11d24..ff21218989 100644 --- a/packages/documentation/public/assets/scripts/autolink.js +++ b/packages/documentation/public/assets/scripts/autolink.js @@ -5,7 +5,7 @@ window.addEventListener('storybook:contentReady', function () { links.forEach(link => { const anchor = link.getAttribute('href'); if (anchor.startsWith('#')) { - link.setAttribute('href', `${window.parent.location.href}${anchor}`); + link.setAttribute('href', `${window.parent.location.href.replace(/#.*/, '')}${anchor}`); } }); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8cfcc12db0..f4ece26f13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -611,11 +611,11 @@ importers: specifier: 15.5.0 version: 15.5.0(react@18.3.1) rehype-autolink-headings: - specifier: ^7.1.0 + specifier: 7.1.0 version: 7.1.0 - remark-autolink-headings: - specifier: 7.0.1 - version: 7.0.1 + rehype-slug: + specifier: 6.0.0 + version: 6.0.0 rimraf: specifier: 6.0.1 version: 6.0.1 @@ -7283,10 +7283,6 @@ packages: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} - is-buffer@2.0.5: - resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} - engines: {node: '>=4'} - is-builtin-module@3.2.1: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} @@ -9744,9 +9740,6 @@ packages: rehype-slug@6.0.0: resolution: {integrity: sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A==} - remark-autolink-headings@7.0.1: - resolution: {integrity: sha512-a1BIwoJ0cSnX+sPp5u3AFULBFWHGYBt57Fo4a+7IlGiJOQxs8b7uYAE5Iu26Ocl7Y5cvinZy3FaGVruLCKg6vA==} - remark-mdx@3.0.1: resolution: {integrity: sha512-3Pz3yPQ5Rht2pM5R+0J2MrGoBSrzf+tJG94N+t/ilfdh8YLyyKYtidAYwTveB20BoHAcwIopOUqhcmh2F7hGYA==} @@ -10898,9 +10891,6 @@ packages: unified-engine@11.2.1: resolution: {integrity: sha512-xBAdZ8UY2X4R9Hm6X6kMne4Nz0PlpOc1oE6DPeqJnewr5Imkb8uT5Eyvy1h7xNekPL3PSWh3ZJyNrMW6jnNQBg==} - unified@10.1.2: - resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==} - unified@11.0.4: resolution: {integrity: sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ==} @@ -10923,9 +10913,6 @@ packages: unist-util-inspect@8.0.0: resolution: {integrity: sha512-/3Wn/wU6/H6UEo4FoYUeo8KUePN8ERiZpQYFWYoihOsr1DoDuv80PeB0hobVZyYSvALa2e556bG1A1/AbwU4yg==} - unist-util-is@5.2.1: - resolution: {integrity: sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==} - unist-util-is@6.0.0: resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} @@ -10938,21 +10925,12 @@ packages: unist-util-stringify-position@2.0.3: resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} - unist-util-stringify-position@3.0.3: - resolution: {integrity: sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==} - unist-util-stringify-position@4.0.0: resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==} - unist-util-visit-parents@5.1.3: - resolution: {integrity: sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==} - unist-util-visit-parents@6.0.1: resolution: {integrity: sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==} - unist-util-visit@4.1.2: - resolution: {integrity: sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==} - unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} @@ -11076,9 +11054,6 @@ packages: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} - vfile-message@3.1.4: - resolution: {integrity: sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==} - vfile-message@4.0.2: resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} @@ -11091,9 +11066,6 @@ packages: vfile-statistics@3.0.0: resolution: {integrity: sha512-/qlwqwWBWFOmpXujL/20P+Iuydil0rZZNglR+VNm6J0gpLHwuVM5s7g2TfVoswbXjZ4HuIhLMySEyIw5i7/D8w==} - vfile@5.3.7: - resolution: {integrity: sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==} - vfile@6.0.1: resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==} @@ -15952,11 +15924,11 @@ snapshots: '@types/hast@2.3.4': dependencies: - '@types/unist': 2.0.6 + '@types/unist': 3.0.2 '@types/hast@3.0.3': dependencies: - '@types/unist': 2.0.6 + '@types/unist': 3.0.2 '@types/http-proxy@1.17.11': dependencies: @@ -20243,8 +20215,6 @@ snapshots: call-bind: 1.0.7 has-tostringtag: 1.0.2 - is-buffer@2.0.5: {} - is-builtin-module@3.2.1: dependencies: builtin-modules: 3.3.0 @@ -23510,14 +23480,6 @@ snapshots: hast-util-to-string: 3.0.0 unist-util-visit: 5.0.0 - remark-autolink-headings@7.0.1: - dependencies: - '@types/hast': 2.3.4 - '@types/mdast': 3.0.15 - extend: 3.0.2 - unified: 10.1.2 - unist-util-visit: 4.1.2 - remark-mdx@3.0.1: dependencies: mdast-util-mdx: 3.0.0 @@ -25016,16 +24978,6 @@ snapshots: transitivePeerDependencies: - supports-color - unified@10.1.2: - dependencies: - '@types/unist': 2.0.6 - bail: 2.0.2 - extend: 3.0.2 - is-buffer: 2.0.5 - is-plain-obj: 4.1.0 - trough: 2.1.0 - vfile: 5.3.7 - unified@11.0.4: dependencies: '@types/unist': 3.0.2 @@ -25056,10 +25008,6 @@ snapshots: dependencies: '@types/unist': 3.0.2 - unist-util-is@5.2.1: - dependencies: - '@types/unist': 2.0.6 - unist-util-is@6.0.0: dependencies: '@types/unist': 3.0.2 @@ -25077,30 +25025,15 @@ snapshots: dependencies: '@types/unist': 2.0.6 - unist-util-stringify-position@3.0.3: - dependencies: - '@types/unist': 2.0.6 - unist-util-stringify-position@4.0.0: dependencies: '@types/unist': 3.0.2 - unist-util-visit-parents@5.1.3: - dependencies: - '@types/unist': 2.0.6 - unist-util-is: 5.2.1 - unist-util-visit-parents@6.0.1: dependencies: '@types/unist': 3.0.2 unist-util-is: 6.0.0 - unist-util-visit@4.1.2: - dependencies: - '@types/unist': 2.0.6 - unist-util-is: 5.2.1 - unist-util-visit-parents: 5.1.3 - unist-util-visit@5.0.0: dependencies: '@types/unist': 3.0.2 @@ -25219,11 +25152,6 @@ snapshots: core-util-is: 1.0.2 extsprintf: 1.3.0 - vfile-message@3.1.4: - dependencies: - '@types/unist': 2.0.6 - unist-util-stringify-position: 3.0.3 - vfile-message@4.0.2: dependencies: '@types/unist': 3.0.2 @@ -25250,13 +25178,6 @@ snapshots: vfile: 6.0.1 vfile-message: 4.0.2 - vfile@5.3.7: - dependencies: - '@types/unist': 2.0.6 - is-buffer: 2.0.5 - unist-util-stringify-position: 3.0.3 - vfile-message: 3.1.4 - vfile@6.0.1: dependencies: '@types/unist': 3.0.2