From 691a39c93568fc29bf62b26a699e8d5537d95793 Mon Sep 17 00:00:00 2001 From: Adam DeHaven Date: Tue, 13 Feb 2024 12:11:57 -0500 Subject: [PATCH 1/2] feat(shiki): switch to official shiki package --- package.json | 4 +- pnpm-lock.yaml | 106 +++++----------- renovate.json | 6 +- src/composables/index.ts | 4 +- src/composables/useMarkdownIt.ts | 6 +- src/composables/useShiki.ts | 199 +++++++++++++++++++++++++++++++ src/composables/useShikiji.ts | 199 ------------------------------- 7 files changed, 238 insertions(+), 286 deletions(-) create mode 100644 src/composables/useShiki.ts delete mode 100644 src/composables/useShikiji.ts diff --git a/package.json b/package.json index 6bf69484..b36efcf4 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "@kong/design-tokens": "^1.12.7", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", + "@shikijs/markdown-it": "^1.1.2", "@types/jsdom": "^21.1.6", "@types/markdown-it": "^13.0.7", "@types/markdown-it-attrs": "^4.1.3", @@ -107,14 +108,13 @@ "eslint-plugin-promise": "^6.1.1", "eslint-plugin-vue": "^9.20.1", "jsdom": "^23.2.0", - "markdown-it-shikiji": "^0.9.19", "postcss": "^8.4.33", "postcss-html": "^1.6.0", "rimraf": "^5.0.5", "rollup-plugin-visualizer": "^5.12.0", "sass": "^1.70.0", "semantic-release": "^22.0.12", - "shikiji": "^0.9.19", + "shiki": "^1.1.2", "stylelint": "^16.2.0", "stylelint-config-html": "^1.1.0", "stylelint-config-recommended-scss": "^14.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 78430457..649bc2e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,6 +88,9 @@ devDependencies: '@semantic-release/git': specifier: ^10.0.1 version: 10.0.1(semantic-release@22.0.12) + '@shikijs/markdown-it': + specifier: ^1.1.2 + version: 1.1.2 '@types/jsdom': specifier: ^21.1.6 version: 21.1.6 @@ -163,9 +166,6 @@ devDependencies: jsdom: specifier: ^23.2.0 version: 23.2.0 - markdown-it-shikiji: - specifier: ^0.9.19 - version: 0.9.19 postcss: specifier: ^8.4.33 version: 8.4.33 @@ -184,9 +184,9 @@ devDependencies: semantic-release: specifier: ^22.0.12 version: 22.0.12(typescript@5.3.3) - shikiji: - specifier: ^0.9.19 - version: 0.9.19 + shiki: + specifier: ^1.1.2 + version: 1.1.2 stylelint: specifier: ^16.2.0 version: 16.2.1(typescript@5.3.3) @@ -637,16 +637,6 @@ packages: conventional-changelog-conventionalcommits: 7.0.2 dev: true - /@commitlint/config-validator@18.4.4: - resolution: {integrity: sha512-/QI8KIg/h7O0Eus36fPcEcO3QPBcdXuGfZeCF5m15k0EB2bcU8s6pHNTNEa6xz9PrAefHCL+yzRJj7w20T6Mow==} - engines: {node: '>=v18'} - requiresBuild: true - dependencies: - '@commitlint/types': 18.4.4 - ajv: 8.12.0 - dev: true - optional: true - /@commitlint/config-validator@18.6.0: resolution: {integrity: sha512-Ptfa865arNozlkjxrYG3qt6wT9AlhNUHeuDyKEZiTL/l0ftncFhK/KN0t/EAMV2tec+0Mwxo0FmhbESj/bI+1g==} engines: {node: '>=v18'} @@ -699,28 +689,6 @@ packages: '@commitlint/types': 18.6.0 dev: true - /@commitlint/load@18.4.4(@types/node@20.11.5)(typescript@5.3.3): - resolution: {integrity: sha512-RaDIa9qwOw2xRJ3Jr2DBXd14rmnHJIX2XdZF4kmoF1rgsg/+7cvrExLSUNAkQUNimyjCn1b/bKX2Omm+GdY0XQ==} - engines: {node: '>=v18'} - requiresBuild: true - dependencies: - '@commitlint/config-validator': 18.4.4 - '@commitlint/execute-rule': 18.4.4 - '@commitlint/resolve-extends': 18.4.4 - '@commitlint/types': 18.4.4 - chalk: 4.1.2 - cosmiconfig: 8.3.6(typescript@5.3.3) - cosmiconfig-typescript-loader: 5.0.0(@types/node@20.11.5)(cosmiconfig@8.3.6)(typescript@5.3.3) - lodash.isplainobject: 4.0.6 - lodash.merge: 4.6.2 - lodash.uniq: 4.5.0 - resolve-from: 5.0.0 - transitivePeerDependencies: - - '@types/node' - - typescript - dev: true - optional: true - /@commitlint/load@18.6.0(@types/node@20.11.5)(typescript@5.3.3): resolution: {integrity: sha512-RRssj7TmzT0bowoEKlgwg8uQ7ORXWkw7lYLsZZBMi9aInsJuGNLNWcMxJxRZbwxG3jkCidGUg85WmqJvRjsaDA==} engines: {node: '>=v18'} @@ -765,20 +733,6 @@ packages: minimist: 1.2.8 dev: true - /@commitlint/resolve-extends@18.4.4: - resolution: {integrity: sha512-RRpIHSbRnFvmGifVk21Gqazf1QF/yeP+Kkg/e3PlkegcOKd/FGOXp/Kx9cvSO2K7ucSn4GD/oBvgasFoy+NCAw==} - engines: {node: '>=v18'} - requiresBuild: true - dependencies: - '@commitlint/config-validator': 18.4.4 - '@commitlint/types': 18.4.4 - import-fresh: 3.3.0 - lodash.mergewith: 4.6.2 - resolve-from: 5.0.0 - resolve-global: 1.0.0 - dev: true - optional: true - /@commitlint/resolve-extends@18.6.0: resolution: {integrity: sha512-k2Xp+Fxeggki2i90vGrbiLDMefPius3zGSTFFlRAPKce/SWLbZtI+uqE9Mne23mHO5lmcSV8z5m6ziiJwGpOcg==} engines: {node: '>=v18'} @@ -814,15 +768,6 @@ packages: find-up: 5.0.0 dev: true - /@commitlint/types@18.4.4: - resolution: {integrity: sha512-/FykLtodD8gKs3+VNkAUwofu4LBHankclj+I8fB2jTRvG6PV7k/OUt4P+VbM7ip853qS4F0g7Z6hLNa6JeMcAQ==} - engines: {node: '>=v18'} - requiresBuild: true - dependencies: - chalk: 4.1.2 - dev: true - optional: true - /@commitlint/types@18.6.0: resolution: {integrity: sha512-oavoKLML/eJa2rJeyYSbyGAYzTxQ6voG5oeX3OrxpfrkRWhJfm4ACnhoRf5tgiybx2MZ+EVFqC1Lw3W8/uwpZA==} engines: {node: '>=v18'} @@ -885,7 +830,7 @@ packages: right-pad: 1.0.1 word-wrap: 1.2.5 optionalDependencies: - '@commitlint/load': 18.4.4(@types/node@20.11.5)(typescript@5.3.3) + '@commitlint/load': 18.6.0(@types/node@20.11.5)(typescript@5.3.3) transitivePeerDependencies: - '@types/node' - typescript @@ -1629,6 +1574,24 @@ packages: - supports-color dev: true + /@shikijs/core@1.1.2: + resolution: {integrity: sha512-ERVzNQz88ZkDqUpWeC57Kp+Kmx5RjqeDBR1M8AGWGom4yrkITiTfXCGmjchlDSw12MhDTuPYR4HVFW8uT61RaQ==} + dev: true + + /@shikijs/markdown-it@1.1.2: + resolution: {integrity: sha512-A9kD0fpu4mfaJNwX31BTX7syMZ8pd37okzCMI2qLVWu1Fsacr5bct5aD3aLxPwXmgspD/xhWb2zUBkudOcTAZQ==} + dependencies: + '@shikijs/transformers': 1.1.2 + markdown-it: 14.0.0 + shiki: 1.1.2 + dev: true + + /@shikijs/transformers@1.1.2: + resolution: {integrity: sha512-tldkUMW7RBkU2F6eXbiRMw3ja+hQer1EjwhD2NGOv6K0pgZdVp3JKjU8uisRtg65tyBqrVHq7zlLHVk7EKmUZA==} + dependencies: + shiki: 1.1.2 + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -3149,7 +3112,7 @@ packages: longest: 2.0.1 word-wrap: 1.2.5 optionalDependencies: - '@commitlint/load': 18.4.4(@types/node@20.11.5)(typescript@5.3.3) + '@commitlint/load': 18.6.0(@types/node@20.11.5)(typescript@5.3.3) transitivePeerDependencies: - '@types/node' - typescript @@ -5639,13 +5602,6 @@ packages: resolution: {integrity: sha512-YLhzaOsU9THO/cal0lUjfMjrqSMPjjyjChYM7oyj4DnyaXEzA8gnW6cVJeyCrCVeyesrY2PlEdUYJSPFYL4Nkg==} dev: false - /markdown-it-shikiji@0.9.19: - resolution: {integrity: sha512-AjGg991Tge1VbQb4whEvJ0Xa8Dopjowd0Mxy0ntzkCAuRwjNUhriGqu0AZEjM8Caab5+324VD8eEkPD7ihUIMA==} - dependencies: - markdown-it: 14.0.0 - shikiji: 0.9.19 - dev: true - /markdown-it-sub@2.0.0: resolution: {integrity: sha512-iCBKgwCkfQBRg2vApy9vx1C1Tu6D8XYo8NvevI3OlwzBRmiMtsJ2sXupBgEA7PPxiDwNni3qIUkhZ6j5wofDUA==} dev: false @@ -7198,14 +7154,10 @@ packages: engines: {node: '>=8'} dev: true - /shikiji-core@0.9.19: - resolution: {integrity: sha512-AFJu/vcNT21t0e6YrfadZ+9q86gvPum6iywRyt1OtIPjPFe25RQnYJyxHQPMLKCCWA992TPxmEmbNcOZCAJclw==} - dev: true - - /shikiji@0.9.19: - resolution: {integrity: sha512-Kw2NHWktdcdypCj1GkKpXH4o6Vxz8B8TykPlPuLHOGSV8VkhoCLcFOH4k19K4LXAQYRQmxg+0X/eM+m2sLhAkg==} + /shiki@1.1.2: + resolution: {integrity: sha512-qNzFwTv5uhEDNUIwp7wHjsrffVeLbmOgWnM5mZZhoiz7G2qAUvqVfUzuWfieD45/YAKipzCtdV9SndacKtABow==} dependencies: - shikiji-core: 0.9.19 + '@shikijs/core': 1.1.2 dev: true /side-channel@1.0.4: diff --git a/renovate.json b/renovate.json index 3e6ff052..f7d58f45 100644 --- a/renovate.json +++ b/renovate.json @@ -16,10 +16,10 @@ }, { "automerge": true, - "groupName": "all shikiji dependencies", - "groupSlug": "all-shikiji-dependencies", + "groupName": "all shiki dependencies", + "groupSlug": "all-shiki-dependencies", "matchPackagePatterns": [ - "^(.*)?shikiji" + "^(.*)?shiki" ] } ] diff --git a/src/composables/index.ts b/src/composables/index.ts index 4da2598e..e8eae10b 100644 --- a/src/composables/index.ts +++ b/src/composables/index.ts @@ -2,7 +2,7 @@ import useDebounce from './useDebounce' import useKeyboardShortcuts from './useKeyboardShortcuts' import useMarkdownActions from './useMarkdownActions' import useMarkdownIt from './useMarkdownIt' -import useShikiji from './useShikiji' +import useShiki from './useShiki' import useSyncScroll from './useSyncScroll' export default { @@ -10,6 +10,6 @@ export default { useKeyboardShortcuts, useMarkdownActions, useMarkdownIt, - useShikiji, + useShiki, useSyncScroll, } diff --git a/src/composables/useMarkdownIt.ts b/src/composables/useMarkdownIt.ts index b077ae03..de1fc82d 100644 --- a/src/composables/useMarkdownIt.ts +++ b/src/composables/useMarkdownIt.ts @@ -1,5 +1,5 @@ import { ref } from 'vue' -import useShikiji from '@/composables/useShikiji' +import useShiki from '@/composables/useShiki' import { NEW_LINE_CHARACTER, COPY_ICON_SVG, HEADER_LINK_ICON_SVG } from '@/constants' import type { Theme } from '@/types' @@ -26,7 +26,7 @@ const md = ref() export default function useMarkdownIt() { /** Initialize markdown-it - ideally called in the `onBeforeMount` hook */ const init = async (theme: Theme = 'light'): Promise => { - const { MarkdownItShikiji } = useShikiji() + const { MarkdownItShiki } = useShiki() md.value = MarkdownIt({ html: false, // Keep disabled to prevent XSS @@ -36,7 +36,7 @@ export default function useMarkdownIt() { typographer: true, // Enable some language-neutral replacement + quotes beautification quotes: '“”‘’', }) - .use(await MarkdownItShikiji(theme)) + .use(await MarkdownItShiki(theme)) .use(anchor, { level: 2, slugify: s => slugify(s), diff --git a/src/composables/useShiki.ts b/src/composables/useShiki.ts new file mode 100644 index 00000000..2bd1ce0e --- /dev/null +++ b/src/composables/useShiki.ts @@ -0,0 +1,199 @@ +import { fromHighlighter } from '@shikijs/markdown-it/core' +import { getHighlighterCore } from 'shiki/core' +import getWasm from 'shiki/wasm' +import type { Theme } from '@/types' + +export default function useShiki() { + const MarkdownItShiki = async (theme: Theme = 'light') => { + const highlighter = await getHighlighterCore({ + themes: [ + import('shiki/themes/material-theme-lighter.mjs'), + import('shiki/themes/material-theme-palenight.mjs'), + ], + // TODO: For now, I'm including all languages but this bumps up the package size ~6MB + langs: [ + import('shiki/langs/abap.mjs'), + import('shiki/langs/actionscript-3.mjs'), + import('shiki/langs/ada.mjs'), + import('shiki/langs/apache.mjs'), + import('shiki/langs/apex.mjs'), + import('shiki/langs/apl.mjs'), + import('shiki/langs/applescript.mjs'), + import('shiki/langs/ara.mjs'), + import('shiki/langs/asm.mjs'), + import('shiki/langs/astro.mjs'), + import('shiki/langs/awk.mjs'), + import('shiki/langs/ballerina.mjs'), + import('shiki/langs/bat.mjs'), + import('shiki/langs/beancount.mjs'), + import('shiki/langs/berry.mjs'), + import('shiki/langs/bibtex.mjs'), + import('shiki/langs/bicep.mjs'), + import('shiki/langs/blade.mjs'), + import('shiki/langs/c.mjs'), + import('shiki/langs/cadence.mjs'), + import('shiki/langs/clarity.mjs'), + import('shiki/langs/clojure.mjs'), + import('shiki/langs/cmake.mjs'), + import('shiki/langs/cobol.mjs'), + import('shiki/langs/codeql.mjs'), + import('shiki/langs/coffee.mjs'), + import('shiki/langs/cpp.mjs'), + import('shiki/langs/crystal.mjs'), + import('shiki/langs/csharp.mjs'), + import('shiki/langs/css.mjs'), + import('shiki/langs/csv.mjs'), + import('shiki/langs/cue.mjs'), + import('shiki/langs/cypher.mjs'), + import('shiki/langs/d.mjs'), + import('shiki/langs/dart.mjs'), + import('shiki/langs/dax.mjs'), + import('shiki/langs/diff.mjs'), + import('shiki/langs/docker.mjs'), + import('shiki/langs/dream-maker.mjs'), + import('shiki/langs/elixir.mjs'), + import('shiki/langs/elm.mjs'), + import('shiki/langs/erb.mjs'), + import('shiki/langs/erlang.mjs'), + import('shiki/langs/fish.mjs'), + import('shiki/langs/fsharp.mjs'), + import('shiki/langs/gdresource.mjs'), + import('shiki/langs/gdscript.mjs'), + import('shiki/langs/gdshader.mjs'), + import('shiki/langs/gherkin.mjs'), + import('shiki/langs/git-commit.mjs'), + import('shiki/langs/git-rebase.mjs'), + import('shiki/langs/glimmer-js.mjs'), + import('shiki/langs/glimmer-ts.mjs'), + import('shiki/langs/glsl.mjs'), + import('shiki/langs/gnuplot.mjs'), + import('shiki/langs/go.mjs'), + import('shiki/langs/graphql.mjs'), + import('shiki/langs/groovy.mjs'), + import('shiki/langs/hack.mjs'), + import('shiki/langs/haml.mjs'), + import('shiki/langs/handlebars.mjs'), + import('shiki/langs/haskell.mjs'), + import('shiki/langs/hcl.mjs'), + import('shiki/langs/hjson.mjs'), + import('shiki/langs/hlsl.mjs'), + import('shiki/langs/html.mjs'), + import('shiki/langs/imba.mjs'), + import('shiki/langs/ini.mjs'), + import('shiki/langs/java.mjs'), + import('shiki/langs/javascript.mjs'), + import('shiki/langs/jinja.mjs'), + import('shiki/langs/jison.mjs'), + import('shiki/langs/json.mjs'), + import('shiki/langs/json5.mjs'), + import('shiki/langs/jsonc.mjs'), + import('shiki/langs/jsonl.mjs'), + import('shiki/langs/jsonnet.mjs'), + import('shiki/langs/jssm.mjs'), + import('shiki/langs/jsx.mjs'), + import('shiki/langs/julia.mjs'), + import('shiki/langs/kotlin.mjs'), + import('shiki/langs/kusto.mjs'), + import('shiki/langs/latex.mjs'), + import('shiki/langs/less.mjs'), + import('shiki/langs/liquid.mjs'), + import('shiki/langs/lisp.mjs'), + import('shiki/langs/logo.mjs'), + import('shiki/langs/lua.mjs'), + import('shiki/langs/make.mjs'), + import('shiki/langs/markdown.mjs'), + import('shiki/langs/marko.mjs'), + import('shiki/langs/matlab.mjs'), + import('shiki/langs/mdc.mjs'), + import('shiki/langs/mdx.mjs'), + import('shiki/langs/mermaid.mjs'), + import('shiki/langs/mojo.mjs'), + import('shiki/langs/narrat.mjs'), + import('shiki/langs/nextflow.mjs'), + import('shiki/langs/nginx.mjs'), + import('shiki/langs/nim.mjs'), + import('shiki/langs/nix.mjs'), + import('shiki/langs/nushell.mjs'), + import('shiki/langs/objective-c.mjs'), + import('shiki/langs/objective-cpp.mjs'), + import('shiki/langs/ocaml.mjs'), + import('shiki/langs/pascal.mjs'), + import('shiki/langs/perl.mjs'), + import('shiki/langs/php.mjs'), + import('shiki/langs/plsql.mjs'), + import('shiki/langs/postcss.mjs'), + import('shiki/langs/powerquery.mjs'), + import('shiki/langs/powershell.mjs'), + import('shiki/langs/prisma.mjs'), + import('shiki/langs/prolog.mjs'), + import('shiki/langs/proto.mjs'), + import('shiki/langs/pug.mjs'), + import('shiki/langs/puppet.mjs'), + import('shiki/langs/purescript.mjs'), + import('shiki/langs/python.mjs'), + import('shiki/langs/r.mjs'), + import('shiki/langs/raku.mjs'), + import('shiki/langs/razor.mjs'), + import('shiki/langs/reg.mjs'), + import('shiki/langs/rel.mjs'), + import('shiki/langs/riscv.mjs'), + import('shiki/langs/rst.mjs'), + import('shiki/langs/ruby.mjs'), + import('shiki/langs/rust.mjs'), + import('shiki/langs/sas.mjs'), + import('shiki/langs/sass.mjs'), + import('shiki/langs/scala.mjs'), + import('shiki/langs/scheme.mjs'), + import('shiki/langs/scss.mjs'), + import('shiki/langs/shaderlab.mjs'), + import('shiki/langs/shellscript.mjs'), + import('shiki/langs/shellsession.mjs'), + import('shiki/langs/smalltalk.mjs'), + import('shiki/langs/solidity.mjs'), + import('shiki/langs/sparql.mjs'), + import('shiki/langs/splunk.mjs'), + import('shiki/langs/sql.mjs'), + import('shiki/langs/ssh-config.mjs'), + import('shiki/langs/stata.mjs'), + import('shiki/langs/stylus.mjs'), + import('shiki/langs/svelte.mjs'), + import('shiki/langs/swift.mjs'), + import('shiki/langs/system-verilog.mjs'), + import('shiki/langs/tasl.mjs'), + import('shiki/langs/tcl.mjs'), + import('shiki/langs/tex.mjs'), + import('shiki/langs/toml.mjs'), + import('shiki/langs/tsx.mjs'), + import('shiki/langs/turtle.mjs'), + import('shiki/langs/twig.mjs'), + import('shiki/langs/typescript.mjs'), + import('shiki/langs/v.mjs'), + import('shiki/langs/vb.mjs'), + import('shiki/langs/verilog.mjs'), + import('shiki/langs/vhdl.mjs'), + import('shiki/langs/viml.mjs'), + import('shiki/langs/vue.mjs'), + import('shiki/langs/vue-html.mjs'), + import('shiki/langs/vyper.mjs'), + import('shiki/langs/wasm.mjs'), + import('shiki/langs/wenyan.mjs'), + import('shiki/langs/wgsl.mjs'), + import('shiki/langs/wolfram.mjs'), + import('shiki/langs/xml.mjs'), + import('shiki/langs/xsl.mjs'), + import('shiki/langs/yaml.mjs'), + import('shiki/langs/zenscript.mjs'), + import('shiki/langs/zig.mjs'), + ], + loadWasm: getWasm, + }) + + return fromHighlighter(highlighter, { + theme: theme === 'light' ? 'material-theme-lighter' : 'material-theme-palenight', + }) + } + + return { + MarkdownItShiki, + } +} diff --git a/src/composables/useShikiji.ts b/src/composables/useShikiji.ts deleted file mode 100644 index ec32d540..00000000 --- a/src/composables/useShikiji.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { fromHighlighter } from 'markdown-it-shikiji/core' -import { getHighlighterCore } from 'shikiji/core' -import { getWasmInlined } from 'shikiji/wasm' -import type { Theme } from '@/types' - -export default function useShikiji() { - const MarkdownItShikiji = async (theme: Theme = 'light') => { - const highlighter = await getHighlighterCore({ - themes: [ - import('shikiji/themes/material-theme-lighter.mjs'), - import('shikiji/themes/material-theme-palenight.mjs'), - ], - // TODO: For now, I'm including all languages but this bumps up the package size ~6MB - langs: [ - import('shikiji/langs/abap.mjs'), - import('shikiji/langs/actionscript-3.mjs'), - import('shikiji/langs/ada.mjs'), - import('shikiji/langs/apache.mjs'), - import('shikiji/langs/apex.mjs'), - import('shikiji/langs/apl.mjs'), - import('shikiji/langs/applescript.mjs'), - import('shikiji/langs/ara.mjs'), - import('shikiji/langs/asm.mjs'), - import('shikiji/langs/astro.mjs'), - import('shikiji/langs/awk.mjs'), - import('shikiji/langs/ballerina.mjs'), - import('shikiji/langs/bat.mjs'), - import('shikiji/langs/beancount.mjs'), - import('shikiji/langs/berry.mjs'), - import('shikiji/langs/bibtex.mjs'), - import('shikiji/langs/bicep.mjs'), - import('shikiji/langs/blade.mjs'), - import('shikiji/langs/c.mjs'), - import('shikiji/langs/cadence.mjs'), - import('shikiji/langs/clarity.mjs'), - import('shikiji/langs/clojure.mjs'), - import('shikiji/langs/cmake.mjs'), - import('shikiji/langs/cobol.mjs'), - import('shikiji/langs/codeql.mjs'), - import('shikiji/langs/coffee.mjs'), - import('shikiji/langs/cpp.mjs'), - import('shikiji/langs/crystal.mjs'), - import('shikiji/langs/csharp.mjs'), - import('shikiji/langs/css.mjs'), - import('shikiji/langs/csv.mjs'), - import('shikiji/langs/cue.mjs'), - import('shikiji/langs/cypher.mjs'), - import('shikiji/langs/d.mjs'), - import('shikiji/langs/dart.mjs'), - import('shikiji/langs/dax.mjs'), - import('shikiji/langs/diff.mjs'), - import('shikiji/langs/docker.mjs'), - import('shikiji/langs/dream-maker.mjs'), - import('shikiji/langs/elixir.mjs'), - import('shikiji/langs/elm.mjs'), - import('shikiji/langs/erb.mjs'), - import('shikiji/langs/erlang.mjs'), - import('shikiji/langs/fish.mjs'), - import('shikiji/langs/fsharp.mjs'), - import('shikiji/langs/gdresource.mjs'), - import('shikiji/langs/gdscript.mjs'), - import('shikiji/langs/gdshader.mjs'), - import('shikiji/langs/gherkin.mjs'), - import('shikiji/langs/git-commit.mjs'), - import('shikiji/langs/git-rebase.mjs'), - import('shikiji/langs/glimmer-js.mjs'), - import('shikiji/langs/glimmer-ts.mjs'), - import('shikiji/langs/glsl.mjs'), - import('shikiji/langs/gnuplot.mjs'), - import('shikiji/langs/go.mjs'), - import('shikiji/langs/graphql.mjs'), - import('shikiji/langs/groovy.mjs'), - import('shikiji/langs/hack.mjs'), - import('shikiji/langs/haml.mjs'), - import('shikiji/langs/handlebars.mjs'), - import('shikiji/langs/haskell.mjs'), - import('shikiji/langs/hcl.mjs'), - import('shikiji/langs/hjson.mjs'), - import('shikiji/langs/hlsl.mjs'), - import('shikiji/langs/html.mjs'), - import('shikiji/langs/imba.mjs'), - import('shikiji/langs/ini.mjs'), - import('shikiji/langs/java.mjs'), - import('shikiji/langs/javascript.mjs'), - import('shikiji/langs/jinja.mjs'), - import('shikiji/langs/jison.mjs'), - import('shikiji/langs/json.mjs'), - import('shikiji/langs/json5.mjs'), - import('shikiji/langs/jsonc.mjs'), - import('shikiji/langs/jsonl.mjs'), - import('shikiji/langs/jsonnet.mjs'), - import('shikiji/langs/jssm.mjs'), - import('shikiji/langs/jsx.mjs'), - import('shikiji/langs/julia.mjs'), - import('shikiji/langs/kotlin.mjs'), - import('shikiji/langs/kusto.mjs'), - import('shikiji/langs/latex.mjs'), - import('shikiji/langs/less.mjs'), - import('shikiji/langs/liquid.mjs'), - import('shikiji/langs/lisp.mjs'), - import('shikiji/langs/logo.mjs'), - import('shikiji/langs/lua.mjs'), - import('shikiji/langs/make.mjs'), - import('shikiji/langs/markdown.mjs'), - import('shikiji/langs/marko.mjs'), - import('shikiji/langs/matlab.mjs'), - import('shikiji/langs/mdc.mjs'), - import('shikiji/langs/mdx.mjs'), - import('shikiji/langs/mermaid.mjs'), - import('shikiji/langs/mojo.mjs'), - import('shikiji/langs/narrat.mjs'), - import('shikiji/langs/nextflow.mjs'), - import('shikiji/langs/nginx.mjs'), - import('shikiji/langs/nim.mjs'), - import('shikiji/langs/nix.mjs'), - import('shikiji/langs/nushell.mjs'), - import('shikiji/langs/objective-c.mjs'), - import('shikiji/langs/objective-cpp.mjs'), - import('shikiji/langs/ocaml.mjs'), - import('shikiji/langs/pascal.mjs'), - import('shikiji/langs/perl.mjs'), - import('shikiji/langs/php.mjs'), - import('shikiji/langs/plsql.mjs'), - import('shikiji/langs/postcss.mjs'), - import('shikiji/langs/powerquery.mjs'), - import('shikiji/langs/powershell.mjs'), - import('shikiji/langs/prisma.mjs'), - import('shikiji/langs/prolog.mjs'), - import('shikiji/langs/proto.mjs'), - import('shikiji/langs/pug.mjs'), - import('shikiji/langs/puppet.mjs'), - import('shikiji/langs/purescript.mjs'), - import('shikiji/langs/python.mjs'), - import('shikiji/langs/r.mjs'), - import('shikiji/langs/raku.mjs'), - import('shikiji/langs/razor.mjs'), - import('shikiji/langs/reg.mjs'), - import('shikiji/langs/rel.mjs'), - import('shikiji/langs/riscv.mjs'), - import('shikiji/langs/rst.mjs'), - import('shikiji/langs/ruby.mjs'), - import('shikiji/langs/rust.mjs'), - import('shikiji/langs/sas.mjs'), - import('shikiji/langs/sass.mjs'), - import('shikiji/langs/scala.mjs'), - import('shikiji/langs/scheme.mjs'), - import('shikiji/langs/scss.mjs'), - import('shikiji/langs/shaderlab.mjs'), - import('shikiji/langs/shellscript.mjs'), - import('shikiji/langs/shellsession.mjs'), - import('shikiji/langs/smalltalk.mjs'), - import('shikiji/langs/solidity.mjs'), - import('shikiji/langs/sparql.mjs'), - import('shikiji/langs/splunk.mjs'), - import('shikiji/langs/sql.mjs'), - import('shikiji/langs/ssh-config.mjs'), - import('shikiji/langs/stata.mjs'), - import('shikiji/langs/stylus.mjs'), - import('shikiji/langs/svelte.mjs'), - import('shikiji/langs/swift.mjs'), - import('shikiji/langs/system-verilog.mjs'), - import('shikiji/langs/tasl.mjs'), - import('shikiji/langs/tcl.mjs'), - import('shikiji/langs/tex.mjs'), - import('shikiji/langs/toml.mjs'), - import('shikiji/langs/tsx.mjs'), - import('shikiji/langs/turtle.mjs'), - import('shikiji/langs/twig.mjs'), - import('shikiji/langs/typescript.mjs'), - import('shikiji/langs/v.mjs'), - import('shikiji/langs/vb.mjs'), - import('shikiji/langs/verilog.mjs'), - import('shikiji/langs/vhdl.mjs'), - import('shikiji/langs/viml.mjs'), - import('shikiji/langs/vue.mjs'), - import('shikiji/langs/vue-html.mjs'), - import('shikiji/langs/vyper.mjs'), - import('shikiji/langs/wasm.mjs'), - import('shikiji/langs/wenyan.mjs'), - import('shikiji/langs/wgsl.mjs'), - import('shikiji/langs/wolfram.mjs'), - import('shikiji/langs/xml.mjs'), - import('shikiji/langs/xsl.mjs'), - import('shikiji/langs/yaml.mjs'), - import('shikiji/langs/zenscript.mjs'), - import('shikiji/langs/zig.mjs'), - ], - loadWasm: getWasmInlined, - }) - - return fromHighlighter(highlighter, { - theme: theme === 'light' ? 'material-theme-lighter' : 'material-theme-palenight', - }) - } - - return { - MarkdownItShikiji, - } -} From 094004dede9341a0d6c1aadc70361728c4b0ad4d Mon Sep 17 00:00:00 2001 From: Adam DeHaven Date: Tue, 13 Feb 2024 12:16:23 -0500 Subject: [PATCH 2/2] fix: type --- src/composables/useShiki.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/composables/useShiki.ts b/src/composables/useShiki.ts index 2bd1ce0e..43b1cf07 100644 --- a/src/composables/useShiki.ts +++ b/src/composables/useShiki.ts @@ -188,7 +188,7 @@ export default function useShiki() { loadWasm: getWasm, }) - return fromHighlighter(highlighter, { + return fromHighlighter(highlighter as any, { theme: theme === 'light' ? 'material-theme-lighter' : 'material-theme-palenight', }) }