diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74617661d..1e7c018ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,7 +37,7 @@ dependencies: version: 2.0.0 nuxt-mdc: specifier: npm:nuxt-mdc-edge@latest - version: /nuxt-mdc-edge@0.0.2-28213126.b93aa88(rollup@3.28.1) + version: /nuxt-mdc-edge@0.0.2-28214512.e5770b3(rollup@3.28.1) ohash: specifier: ^1.1.3 version: 1.1.3 @@ -1631,6 +1631,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 bundledDependencies: - napi-wasm @@ -1853,6 +1854,11 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true + /@sindresorhus/is@3.1.2: + resolution: {integrity: sha512-JiX9vxoKMmu8Y3Zr2RVathBL1Cdu4Nt4MuNWemt1Nc06A0RAin9c5FArkhGsyMBWfCu4zj+9b+GxtjAnE4qqLQ==} + engines: {node: '>=10'} + dev: false + /@sindresorhus/is@4.6.0: resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} engines: {node: '>=10'} @@ -3121,6 +3127,11 @@ packages: engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} dev: true + /char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + dev: false + /character-entities-html4@1.1.4: resolution: {integrity: sha512-HRcDxZuZqMx3/a+qrzxdBKBPUpxWEq9xw2OPZ3a/174ihfrQKVsFhqtthBInFy1zZ9GgZyFXOatNujm8M+El3g==} dev: true @@ -3872,6 +3883,10 @@ packages: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true + /emojilib@2.4.0: + resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} + dev: false + /emoticon@4.0.1: resolution: {integrity: sha512-dqx7eA9YaqyvYtUhJwT4rC1HIp82j5ybS1/vQ42ur+jBe17dJMwZE4+gvL1XadSFfxaPFFGt3Xsw+Y8akThDlw==} dev: false @@ -6133,6 +6148,7 @@ packages: /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true /log-symbols@4.1.0: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} @@ -6272,6 +6288,15 @@ packages: unist-util-visit-parents: 5.1.3 dev: false + /mdast-util-find-and-replace@3.0.0: + resolution: {integrity: sha512-8wLPIKAvGdA5jgkI8AYKfSorV3og3vE6HA+gKeKEZydbi1EtUu2g4XCxIBj3R+AsFqY/uRtoYbH30tiWsFKkBQ==} + dependencies: + '@types/mdast': 4.0.0 + escape-string-regexp: 5.0.0 + unist-util-is: 6.0.0 + unist-util-visit-parents: 6.0.1 + dev: false + /mdast-util-from-markdown@1.3.1: resolution: {integrity: sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==} dependencies: @@ -6889,6 +6914,9 @@ packages: hasBin: true dev: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -7008,10 +7036,13 @@ packages: engines: {node: '>=10.5.0'} dev: true - /node-emoji@1.11.0: - resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==} + /node-emoji@2.1.0: + resolution: {integrity: sha512-tcsBm9C6FmPN5Wo7OjFi9lgMyJjvkAeirmjR/ax8Ttfqy4N8PoFic26uqFTIgayHPNI5FH4ltUvfh9kHzwcK9A==} dependencies: - lodash: 4.17.21 + '@sindresorhus/is': 3.1.2 + char-regex: 1.0.2 + emojilib: 2.4.0 + skin-tone: 2.0.0 dev: false /node-fetch-native@1.4.0: @@ -7151,8 +7182,8 @@ packages: - supports-color dev: true - /nuxt-mdc-edge@0.0.2-28213126.b93aa88(rollup@3.28.1): - resolution: {integrity: sha512-6onYjt48IYbHccSIaOkBh+GDoAwqgVSaEOz2Qu/XQozN117OLzxz78X0xGlcCShnvEP0hadRTT81Y7LYwJ0l7A==} + /nuxt-mdc-edge@0.0.2-28214512.e5770b3(rollup@3.28.1): + resolution: {integrity: sha512-3jEo0INT+lkmEM8Wez6R80IH4UE1ahXzKrgT8s39ATy7m216yoneqPZBnL8eSVOxVNaZUEmwdnT7hIF/VCKKbw==} dependencies: '@nuxt/kit': 3.6.5(rollup@3.28.1) '@types/hast': 3.0.0 @@ -7172,14 +7203,15 @@ packages: rehype-slug: 5.1.0 rehype-sort-attribute-values: 4.0.0 rehype-sort-attributes: 4.0.0 - remark-emoji: 3.1.2 + remark-emoji: 4.0.0 remark-gfm: 3.0.1 remark-mdc: 1.1.3 remark-parse: 10.0.2 remark-rehype: 10.1.0 scule: 1.0.0 shiki-es: 0.14.0 - unified: 10.1.2 + ufo: 1.2.0 + unified: 11.0.2 unist-builder: 4.0.0 unist-util-visit: 5.0.0 transitivePeerDependencies: @@ -8481,13 +8513,13 @@ packages: - supports-color dev: true - /remark-emoji@3.1.2: - resolution: {integrity: sha512-QwhAzNk27Ol64uV4z/3n55MKrNz9bhr8wg+mO5aGqIYDS+jUarS1d8Y0ZIeEBVhfGkXj6gGYM+727sOgAPvV/A==} + /remark-emoji@4.0.0: + resolution: {integrity: sha512-lQP1lFaYOz6zyJTBfOwYChM1YkgJEVcxSnUBkjo9qujqWwpY36MRFzDjYDk9YNdHqkw5yExB8MnVVHb6wX9QNA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: emoticon: 4.0.1 - mdast-util-find-and-replace: 2.2.2 - node-emoji: 1.11.0 + mdast-util-find-and-replace: 3.0.0 + node-emoji: 2.1.0 dev: false /remark-gfm@3.0.1: @@ -8860,6 +8892,13 @@ packages: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true + /skin-tone@2.0.0: + resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==} + engines: {node: '>=8'} + dependencies: + unicode-emoji-modifier-base: 1.0.0 + dev: false + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -9541,6 +9580,11 @@ packages: '@unhead/shared': 1.3.5 hookable: 5.5.3 + /unicode-emoji-modifier-base@1.0.0: + resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} + engines: {node: '>=4'} + dev: false + /unified@10.1.2: resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==} dependencies: @@ -9553,6 +9597,18 @@ packages: vfile: 5.3.7 dev: false + /unified@11.0.2: + resolution: {integrity: sha512-Zta++onvS/dJ6xUvXQOR5q8XJZOkiMCE5wQ8Yv9mLR25pxRS567EX0GO6HZRxxNV/lznwfsvRZ/1pqe9K9QLeQ==} + dependencies: + '@types/unist': 3.0.0 + '@ungap/structured-clone': 1.2.0 + bail: 2.0.2 + devlop: 1.1.0 + is-plain-obj: 4.1.0 + trough: 2.1.0 + vfile: 6.0.1 + dev: false + /unimport@3.1.3(rollup@3.28.1): resolution: {integrity: sha512-up4TE2yA+nMyyErGTjbYGVw95MriGa2hVRXQ3/JRp7984cwwqULcnBjHaovVpsO8tZc2j0fvgGu9yiBKOyxvYw==} dependencies: @@ -9621,6 +9677,12 @@ packages: '@types/unist': 2.0.7 dev: false + /unist-util-stringify-position@4.0.0: + resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==} + dependencies: + '@types/unist': 3.0.0 + dev: false + /unist-util-visit-parents@3.1.1: resolution: {integrity: sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==} dependencies: @@ -9896,6 +9958,13 @@ packages: unist-util-stringify-position: 3.0.3 dev: false + /vfile-message@4.0.2: + resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} + dependencies: + '@types/unist': 3.0.0 + unist-util-stringify-position: 4.0.0 + dev: false + /vfile@5.3.7: resolution: {integrity: sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==} dependencies: @@ -9905,6 +9974,14 @@ packages: vfile-message: 3.1.4 dev: false + /vfile@6.0.1: + resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==} + dependencies: + '@types/unist': 3.0.0 + unist-util-stringify-position: 4.0.0 + vfile-message: 4.0.2 + dev: false + /vite-node@0.33.0(@types/node@20.5.3): resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} engines: {node: '>=v14.18.0'} diff --git a/src/module.ts b/src/module.ts index d97d65824..657488b5c 100644 --- a/src/module.ts +++ b/src/module.ts @@ -460,6 +460,7 @@ export default defineNuxtModule({ if ( c.filePath.includes('@nuxt/content/dist') || + c.filePath.includes('nuxt-mdc/dist') || c.filePath.includes('nuxt/dist/app') || c.filePath.includes('NuxtWelcome') ) { @@ -634,14 +635,30 @@ export default defineNuxtModule({ // Process markdown plugins, resovle paths contentContext.markdown = processMarkdownOptions(contentContext.markdown) - await installModule('nuxt-mdc', { + const nuxtMDCOptions = { remarkPlugins: contentContext.markdown.remarkPlugins, rehypePlugins: contentContext.markdown.rehypePlugins, highlight: contentContext.highlight, components: { + prose: true, map: contentContext.markdown.tags + }, + headings: { + anchorLinks: { + // Reset defaults + h2: false, h3: false, h4: false + } as Record } - }) + } + + // Apply anchor link generation config + if (contentContext.markdown.anchorLinks) { + for (let i = 0; i < (contentContext.markdown.anchorLinks as any).depth; i++) { + nuxtMDCOptions.headings.anchorLinks[`h${i + 1}`] = !(contentContext.markdown.anchorLinks as any).exclude.includes(i + 1) + } + } + + await installModule('nuxt-mdc', nuxtMDCOptions) nuxt.options.runtimeConfig.public.content = defu(nuxt.options.runtimeConfig.public.content, { locales: options.locales, @@ -658,7 +675,9 @@ export default defineNuxtModule({ }, navigation: contentContext.navigation as any, // Tags will use in markdown renderer for component replacement + // @deprecated tags: contentContext.markdown.tags as any, + // @deprecated highlight: options.highlight as any, wsUrl: '', // Document-driven configuration @@ -667,6 +686,7 @@ export default defineNuxtModule({ trailingSlash: typeof options.documentDriven !== 'boolean' ? options.documentDriven?.trailingSlash ?? false : false, contentHead: options.contentHead ?? true, // Anchor link generation config + // @deprecated anchorLinks: options.markdown.anchorLinks as { depth?: number, exclude?: number[] } }) diff --git a/src/runtime/components/Prose/ProseA.vue b/src/runtime/components/Prose/ProseA.vue deleted file mode 100644 index d97477cc6..000000000 --- a/src/runtime/components/Prose/ProseA.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseBlockquote.vue b/src/runtime/components/Prose/ProseBlockquote.vue deleted file mode 100644 index 656ea529b..000000000 --- a/src/runtime/components/Prose/ProseBlockquote.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseEm.vue b/src/runtime/components/Prose/ProseEm.vue deleted file mode 100644 index 7f4ae1fbf..000000000 --- a/src/runtime/components/Prose/ProseEm.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseH1.vue b/src/runtime/components/Prose/ProseH1.vue deleted file mode 100644 index 6381a794d..000000000 --- a/src/runtime/components/Prose/ProseH1.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseH2.vue b/src/runtime/components/Prose/ProseH2.vue deleted file mode 100644 index c3d2417f4..000000000 --- a/src/runtime/components/Prose/ProseH2.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseH3.vue b/src/runtime/components/Prose/ProseH3.vue deleted file mode 100644 index 9079b8499..000000000 --- a/src/runtime/components/Prose/ProseH3.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseH4.vue b/src/runtime/components/Prose/ProseH4.vue deleted file mode 100644 index be8d1a1da..000000000 --- a/src/runtime/components/Prose/ProseH4.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseH5.vue b/src/runtime/components/Prose/ProseH5.vue deleted file mode 100644 index 032f3e707..000000000 --- a/src/runtime/components/Prose/ProseH5.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseH6.vue b/src/runtime/components/Prose/ProseH6.vue deleted file mode 100644 index 0abccfaae..000000000 --- a/src/runtime/components/Prose/ProseH6.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseHr.vue b/src/runtime/components/Prose/ProseHr.vue deleted file mode 100644 index d26dde647..000000000 --- a/src/runtime/components/Prose/ProseHr.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseImg.vue b/src/runtime/components/Prose/ProseImg.vue deleted file mode 100644 index 124e3833c..000000000 --- a/src/runtime/components/Prose/ProseImg.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/runtime/components/Prose/ProseLi.vue b/src/runtime/components/Prose/ProseLi.vue deleted file mode 100644 index 3bad7d18e..000000000 --- a/src/runtime/components/Prose/ProseLi.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseOl.vue b/src/runtime/components/Prose/ProseOl.vue deleted file mode 100644 index 7d3a886b2..000000000 --- a/src/runtime/components/Prose/ProseOl.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseP.vue b/src/runtime/components/Prose/ProseP.vue deleted file mode 100644 index 14c310f0d..000000000 --- a/src/runtime/components/Prose/ProseP.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseStrong.vue b/src/runtime/components/Prose/ProseStrong.vue deleted file mode 100644 index 994fae33a..000000000 --- a/src/runtime/components/Prose/ProseStrong.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseTable.vue b/src/runtime/components/Prose/ProseTable.vue deleted file mode 100644 index 74b36d32e..000000000 --- a/src/runtime/components/Prose/ProseTable.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseTbody.vue b/src/runtime/components/Prose/ProseTbody.vue deleted file mode 100644 index 09d61910e..000000000 --- a/src/runtime/components/Prose/ProseTbody.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseTd.vue b/src/runtime/components/Prose/ProseTd.vue deleted file mode 100644 index 8bb1a9bb7..000000000 --- a/src/runtime/components/Prose/ProseTd.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseTh.vue b/src/runtime/components/Prose/ProseTh.vue deleted file mode 100644 index 940a96175..000000000 --- a/src/runtime/components/Prose/ProseTh.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseThead.vue b/src/runtime/components/Prose/ProseThead.vue deleted file mode 100644 index 95dbdb7b6..000000000 --- a/src/runtime/components/Prose/ProseThead.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseTr.vue b/src/runtime/components/Prose/ProseTr.vue deleted file mode 100644 index 926f7c1ac..000000000 --- a/src/runtime/components/Prose/ProseTr.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/runtime/components/Prose/ProseUl.vue b/src/runtime/components/Prose/ProseUl.vue deleted file mode 100644 index 5c12ce985..000000000 --- a/src/runtime/components/Prose/ProseUl.vue +++ /dev/null @@ -1,5 +0,0 @@ -