diff --git a/package.json b/package.json index 281605054..65cba4095 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,8 @@ "wrangler": "^3.85.0" }, "resolutions": { + "remark-mdc": "npm:remark-mdc-edge@latest", + "@nuxtjs/mdc": "npm:@nuxtjs/mdc-edge@latest", "@nuxt/content": "workspace:*", "@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@3623989", "vue": "^3.5.12" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 260ded5fc..45e72d2fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,8 @@ settings: excludeLinksFromLockfile: false overrides: + remark-mdc: npm:remark-mdc-edge@latest + '@nuxtjs/mdc': npm:@nuxtjs/mdc-edge@latest '@nuxt/content': workspace:* '@nuxt/ui-pro': https://pkg.pr.new/@nuxt/ui-pro@3623989 vue: ^3.5.12 @@ -20,8 +22,8 @@ importers: specifier: ^3.14.159 version: 3.14.159(magicast@0.3.5)(rollup@3.29.5) '@nuxtjs/mdc': - specifier: ^0.9.2 - version: 0.9.2(magicast@0.3.5)(rollup@3.29.5) + specifier: npm:@nuxtjs/mdc-edge@latest + version: '@nuxtjs/mdc-edge@0.9.3-28861230.0fd67f9(magicast@0.3.5)(rollup@3.29.5)' '@sqlite.org/sqlite-wasm': specifier: 3.47.0-build1 version: 3.47.0-build1 @@ -89,8 +91,8 @@ importers: specifier: '*' version: 8.13.1 remark-mdc: - specifier: latest - version: 3.3.0 + specifier: npm:remark-mdc-edge@latest + version: remark-mdc-edge@3.2.1-28861397.74cee31 scule: specifier: ^1.3.0 version: 1.3.0 @@ -1428,8 +1430,8 @@ packages: '@nuxtjs/color-mode@3.5.2': resolution: {integrity: sha512-cC6RfgZh3guHBMLLjrBB2Uti5eUoGM9KyauOaYS9ETmxNWBMTvpgjvSiSJp1OFljIXPIqVTJ3xtJpSNZiO3ZaA==} - '@nuxtjs/mdc@0.9.2': - resolution: {integrity: sha512-dozIPTPjEYu8jChHNCICZP3mN0sFC6l3aLxTkgv/DAr1EI8jqqqoSZKevzuiHUWGNTguS70+fLcztCwrzWdoYA==} + '@nuxtjs/mdc-edge@0.9.3-28861230.0fd67f9': + resolution: {integrity: sha512-I2vRpQ+gCszHjN21boPwv/oriayghtZMq4FvrT+F/9rbl0kWgQkr5OCHc5X2nAakaqcOA+7CsYuK8Nsl7ukO9Q==} '@nuxtjs/plausible@1.0.3': resolution: {integrity: sha512-jf6W9+Q/VhfHk/jal1gp0OpYU2qwq7eOV4evNKvHWKVM0Qbps+LbKSxNcewgqN91tVx9sv4RbnOEJ8Uq0/FRkg==} @@ -1923,18 +1925,30 @@ packages: '@shikijs/core@1.22.2': resolution: {integrity: sha512-bvIQcd8BEeR1yFvOYv6HDiyta2FFVePbzeowf5pPS1avczrPK+cjmaxxh0nx5QzbON7+Sv0sQfQVciO7bN72sg==} + '@shikijs/core@1.23.0': + resolution: {integrity: sha512-J4Fo22oBlfRHAXec+1AEzcowv+Qdf4ZQkuP/X/UHYH9+KA9LvyFXSXyS+HxuBRFfon+u7bsmKdRBjoZlbDVRkQ==} + '@shikijs/engine-javascript@1.22.2': resolution: {integrity: sha512-iOvql09ql6m+3d1vtvP8fLCVCK7BQD1pJFmHIECsujB0V32BJ0Ab6hxk1ewVSMFA58FI0pR2Had9BKZdyQrxTw==} + '@shikijs/engine-javascript@1.23.0': + resolution: {integrity: sha512-CcrppseWShG+8Efp1iil9divltuXVdCaU4iu+CKvzTGZO5RmXyAiSx668M7VbX8+s/vt1ZKu75Vn/jWi8O3G/Q==} + '@shikijs/engine-oniguruma@1.22.2': resolution: {integrity: sha512-GIZPAGzQOy56mGvWMoZRPggn0dTlBf1gutV5TdceLCZlFNqWmuc7u+CzD0Gd9vQUTgLbrt0KLzz6FNprqYAxlA==} - '@shikijs/transformers@1.22.2': - resolution: {integrity: sha512-8f78OiBa6pZDoZ53lYTmuvpFPlWtevn23bzG+azpPVvZg7ITax57o/K3TC91eYL3OMJOO0onPbgnQyZjRos8XQ==} + '@shikijs/engine-oniguruma@1.23.0': + resolution: {integrity: sha512-gS8bZLqVvmZXX+E5JUMJICsBp+kx6gj79MH/UEpKHKIqnUzppgbmEn6zLa6mB5D+sHse2gFei3YYJxQe1EzZXQ==} + + '@shikijs/transformers@1.23.0': + resolution: {integrity: sha512-YzQN+m8nXNZjI7ZRk+8IdFa13qiOqIqjcm4jIQ31RzgMoHtpd9Ruma1hssnt2ETH3ixr8HEh+0zAuB9w/OBfnw==} '@shikijs/types@1.22.2': resolution: {integrity: sha512-NCWDa6LGZqTuzjsGfXOBWfjS/fDIbDdmVDug+7ykVe1IKT4c1gakrvlfFYp5NhAXH/lyqLM8wsAPo5wNy73Feg==} + '@shikijs/types@1.23.0': + resolution: {integrity: sha512-HiwzsihRao+IbPk7FER/EQT/D0dEEK3n5LAtHDzL5iRT+JMblA7y9uitUnjEnHeLkKigNM+ZplrP7MuEyyc5kA==} + '@shikijs/vscode-textmate@9.3.0': resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==} @@ -3297,6 +3311,9 @@ packages: embla-carousel@8.3.1: resolution: {integrity: sha512-DutFjtEO586XptDn4cwvBJwsR/8fMa4jUk5Jk2g+/elKgu8mdn0Z2sx33g4JskvbLc1/6P8Xg4QlfELGJFcP5A==} + emoji-regex-xs@1.0.0: + resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} + emoji-regex@10.4.0: resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==} @@ -4573,6 +4590,9 @@ packages: micromark-util-sanitize-uri@2.0.0: resolution: {integrity: sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==} + micromark-util-sanitize-uri@2.0.1: + resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==} + micromark-util-subtokenize@2.0.1: resolution: {integrity: sha512-jZNtiFl/1aY73yS3UGQkutD0UbhTt68qnRpw2Pifmz5wV9h8gOVsN70v+Lq/f1rKaU/W8pxRe8y8Q9FX1AOe1Q==} @@ -4918,6 +4938,9 @@ packages: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} + oniguruma-to-es@0.1.2: + resolution: {integrity: sha512-sBYKVJlIMB0WPO+tSu/NNB1ytSFeHyyJZ3Ayxfx3f/QUuXu0lvZk0VB4K7npmdlHSC0ldqanzh/sUSlAbgCTfw==} + oniguruma-to-js@0.4.3: resolution: {integrity: sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==} @@ -5511,6 +5534,12 @@ packages: resolution: {integrity: sha512-J8rn6v4DBb2nnFqkqwy6/NnTYMcgLA+sLr0iIO41qpv0n+ngb7ksag2tMRl0inb1bbO/esUwzW1vbJi7K0sI0g==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + regex-recursion@4.2.1: + resolution: {integrity: sha512-QHNZyZAeKdndD1G3bKAbBEKOSSK4KOHQrAJ01N1LJeb0SoH4DJIeFhp0uUpETgONifS4+P3sOgoA1dhzgrQvhA==} + + regex-utilities@2.3.0: + resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==} + regex@4.4.0: resolution: {integrity: sha512-uCUSuobNVeqUupowbdZub6ggI5/JZkYyJdDogddJr60L764oxC2pMZov1fQ3wM9bdyzUILDG+Sqx6NAKAz9rKQ==} @@ -5561,8 +5590,8 @@ packages: remark-gfm@4.0.0: resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==} - remark-mdc@3.3.0: - resolution: {integrity: sha512-Ofxa/aVSInn1xjIOsWwiB+ovmRkdHKQXapUMXYofEhBXx9f/yOpNYAtDlCyi+wRdqJrdoXsmqOSn9Vly5t8+LA==} + remark-mdc-edge@3.2.1-28861397.74cee31: + resolution: {integrity: sha512-DoZOUZ+2jXpV/V2/HIitOCIUj8FQWHWCa5Zlub5evAZYLlqX50XRHYdwWbLgJERh9z2M8j5LSMXUz0t+4avHew==} remark-parse@11.0.0: resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==} @@ -5768,6 +5797,9 @@ packages: shiki@1.22.2: resolution: {integrity: sha512-3IZau0NdGKXhH2bBlUk4w1IHNxPh6A5B2sUpyY+8utLu2j/h1QpFkAaUA1bAMxOWWGtTWcAh531vnS4NJKS/lA==} + shiki@1.23.0: + resolution: {integrity: sha512-xfdu9DqPkIpExH29cmiTlgo0/jBki5la1Tkfhsv+Wu5TT3APLNHslR1acxuKJOCWqVdSc+pIbs/2ozjVRGppdg==} + siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -8415,10 +8447,10 @@ snapshots: - supports-color - webpack-sources - '@nuxtjs/mdc@0.9.2(magicast@0.3.5)(rollup@3.29.5)': + '@nuxtjs/mdc-edge@0.9.3-28861230.0fd67f9(magicast@0.3.5)(rollup@3.29.5)': dependencies: '@nuxt/kit': 3.14.159(magicast@0.3.5)(rollup@3.29.5) - '@shikijs/transformers': 1.22.2 + '@shikijs/transformers': 1.23.0 '@types/hast': 3.0.4 '@types/mdast': 4.0.4 '@vue/compiler-core': 3.5.12 @@ -8430,7 +8462,7 @@ snapshots: github-slugger: 2.0.0 hast-util-to-string: 3.0.1 mdast-util-to-hast: 13.2.0 - micromark-util-sanitize-uri: 2.0.0 + micromark-util-sanitize-uri: 2.0.1 ohash: 1.1.4 parse5: 7.2.1 pathe: 1.1.2 @@ -8442,11 +8474,11 @@ snapshots: rehype-sort-attributes: 5.0.1 remark-emoji: 5.0.1 remark-gfm: 4.0.0 - remark-mdc: 3.3.0 + remark-mdc: remark-mdc-edge@3.2.1-28861397.74cee31 remark-parse: 11.0.0 remark-rehype: 11.1.1 scule: 1.3.0 - shiki: 1.22.2 + shiki: 1.23.0 ufo: 1.5.4 unified: 11.0.5 unist-builder: 4.0.0 @@ -8936,26 +8968,51 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.3 + '@shikijs/core@1.23.0': + dependencies: + '@shikijs/engine-javascript': 1.23.0 + '@shikijs/engine-oniguruma': 1.23.0 + '@shikijs/types': 1.23.0 + '@shikijs/vscode-textmate': 9.3.0 + '@types/hast': 3.0.4 + hast-util-to-html: 9.0.3 + '@shikijs/engine-javascript@1.22.2': dependencies: '@shikijs/types': 1.22.2 '@shikijs/vscode-textmate': 9.3.0 oniguruma-to-js: 0.4.3 + '@shikijs/engine-javascript@1.23.0': + dependencies: + '@shikijs/types': 1.23.0 + '@shikijs/vscode-textmate': 9.3.0 + oniguruma-to-es: 0.1.2 + '@shikijs/engine-oniguruma@1.22.2': dependencies: '@shikijs/types': 1.22.2 '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/transformers@1.22.2': + '@shikijs/engine-oniguruma@1.23.0': + dependencies: + '@shikijs/types': 1.23.0 + '@shikijs/vscode-textmate': 9.3.0 + + '@shikijs/transformers@1.23.0': dependencies: - shiki: 1.22.2 + shiki: 1.23.0 '@shikijs/types@1.22.2': dependencies: '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 + '@shikijs/types@1.23.0': + dependencies: + '@shikijs/vscode-textmate': 9.3.0 + '@types/hast': 3.0.4 + '@shikijs/vscode-textmate@9.3.0': {} '@shuding/opentype.js@1.4.0-beta.0': @@ -10400,6 +10457,8 @@ snapshots: embla-carousel@8.3.1: {} + emoji-regex-xs@1.0.0: {} + emoji-regex@10.4.0: {} emoji-regex@8.0.0: {} @@ -11953,7 +12012,7 @@ snapshots: micromark-extension-gfm-autolink-literal@2.1.0: dependencies: micromark-util-character: 2.1.0 - micromark-util-sanitize-uri: 2.0.0 + micromark-util-sanitize-uri: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 @@ -11964,7 +12023,7 @@ snapshots: micromark-factory-space: 2.0.0 micromark-util-character: 2.1.0 micromark-util-normalize-identifier: 2.0.0 - micromark-util-sanitize-uri: 2.0.0 + micromark-util-sanitize-uri: 2.0.1 micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 @@ -12089,6 +12148,12 @@ snapshots: micromark-util-encode: 2.0.0 micromark-util-symbol: 2.0.0 + micromark-util-sanitize-uri@2.0.1: + dependencies: + micromark-util-character: 2.1.0 + micromark-util-encode: 2.0.0 + micromark-util-symbol: 2.0.0 + micromark-util-subtokenize@2.0.1: dependencies: devlop: 1.1.0 @@ -12784,6 +12849,12 @@ snapshots: dependencies: mimic-function: 5.0.1 + oniguruma-to-es@0.1.2: + dependencies: + emoji-regex-xs: 1.0.0 + regex: 4.4.0 + regex-recursion: 4.2.1 + oniguruma-to-js@0.4.3: dependencies: regex: 4.4.0 @@ -13420,6 +13491,12 @@ snapshots: dependencies: '@eslint-community/regexpp': 4.12.1 + regex-recursion@4.2.1: + dependencies: + regex-utilities: 2.3.0 + + regex-utilities@2.3.0: {} + regex@4.4.0: {} regexp-ast-analysis@0.7.1: @@ -13524,7 +13601,7 @@ snapshots: transitivePeerDependencies: - supports-color - remark-mdc@3.3.0: + remark-mdc-edge@3.2.1-28861397.74cee31: dependencies: '@types/mdast': 4.0.4 '@types/unist': 3.0.3 @@ -13817,6 +13894,15 @@ snapshots: '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 + shiki@1.23.0: + dependencies: + '@shikijs/core': 1.23.0 + '@shikijs/engine-javascript': 1.23.0 + '@shikijs/engine-oniguruma': 1.23.0 + '@shikijs/types': 1.23.0 + '@shikijs/vscode-textmate': 9.3.0 + '@types/hast': 3.0.4 + siginfo@2.0.0: {} signal-exit@3.0.7: {} diff --git a/src/utils/content/index.ts b/src/utils/content/index.ts index 7e8a981c9..86969dfdb 100644 --- a/src/utils/content/index.ts +++ b/src/utils/content/index.ts @@ -100,19 +100,23 @@ async function _getHighlightPlugin(options: HighlighterOptions) { export async function parseContent(key: string, content: string, collection: ResolvedCollection, nuxt?: Nuxt) { const mdcOptions = (nuxt?.options as unknown as { mdc: MDCModuleOptions })?.mdc || {} const contentOptions = (nuxt?.options as unknown as { content: ModuleOptions })?.content?.build?.markdown || {} + + const rehypeHighlightPlugin = contentOptions.highlight !== false + ? await getHighlightPluginInstance(defu(contentOptions.highlight as HighlighterOptions, mdcOptions.highlight, { compress: true })) + : undefined + const parsedContent = await transformContent(key, content, { markdown: { compress: true, ...mdcOptions, ...contentOptions, rehypePlugins: { - highlight: mdcOptions.highlight === false - ? undefined - : await getHighlightPluginInstance({ ...mdcOptions.highlight, compress: (mdcOptions as { compress: boolean })?.compress !== false }), + highlight: rehypeHighlightPlugin, ...mdcOptions?.rehypePlugins, ...contentOptions?.rehypePlugins, }, remarkPlugins: { + 'remark-emoji': {}, ...mdcOptions?.remarkPlugins, ...contentOptions?.remarkPlugins, },