From c4d2ff012d370e9ad35a1b00eb4b17d0d914a47f Mon Sep 17 00:00:00 2001 From: alexanderdavide Date: Sun, 8 Sep 2024 12:14:46 +0000 Subject: [PATCH] feat!: migrate to Shiki code highlighter --- package-lock.json | 14 ---------- package.json | 4 +-- styles/code.css | 65 ----------------------------------------------- styles/index.ts | 1 - 4 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 styles/code.css diff --git a/package-lock.json b/package-lock.json index 92f4800..36ff929 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "dependencies": { "@slidev/types": "^0.29.2", "codemirror-theme-vars": "^0.1.1", - "prism-theme-vars": "^0.2.2", "theme-vitesse": "^0.1.14" }, "devDependencies": { @@ -8795,14 +8794,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/prism-theme-vars": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/prism-theme-vars/-/prism-theme-vars-0.2.2.tgz", - "integrity": "sha512-EL9ifuU/F8tEldoCa2sspiiLWysCL54xDbf2gN/ubwdtbuJROqOGopG5kSwunapwaioT+jLUQ/Ky+7jnv62xJA==", - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -18029,11 +18020,6 @@ "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true }, - "prism-theme-vars": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/prism-theme-vars/-/prism-theme-vars-0.2.2.tgz", - "integrity": "sha512-EL9ifuU/F8tEldoCa2sspiiLWysCL54xDbf2gN/ubwdtbuJROqOGopG5kSwunapwaioT+jLUQ/Ky+7jnv62xJA==" - }, "prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", diff --git a/package.json b/package.json index 3feb394..2dae064 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "dependencies": { "@slidev/types": "^0.29.2", "codemirror-theme-vars": "^0.1.1", - "prism-theme-vars": "^0.2.2", "theme-vitesse": "^0.1.14" }, "devDependencies": { @@ -55,14 +54,13 @@ }, "slidev": { "colorSchema": "both", - "highlighter": "all", + "highlighter": "shiki", "defaults": { "fonts": { "sans": "Montserrat", "serif": "Roboto Slab", "mono": "Roboto Mono" }, - "hightlighter": "prism", "themeConfig": { "paginationX": "r", "paginationY": "t" diff --git a/styles/code.css b/styles/code.css deleted file mode 100644 index 13dd900..0000000 --- a/styles/code.css +++ /dev/null @@ -1,65 +0,0 @@ -@import 'prism-theme-vars/base.css'; -@import 'codemirror-theme-vars/base.css'; -@import 'prism-theme-vars/to-codemirror.css'; - -:root { - --prism-font-family: var(--slidev-code-font-family); -} - -html:not(.dark) { - --prism-foreground: #393a34; - --prism-background: #f8f8f8; - --prism-comment: #a0ada0; - --prism-string: #b56959; - --prism-literal: #2f8a89; - --prism-number: #296aa3; - --prism-keyword: #1c6b48; - --prism-function: #6c7834; - --prism-boolean: #1c6b48; - --prism-constant: #a65e2b; - --prism-deleted: #a14f55; - --prism-class: #2993a3; - --prism-builtin: #ab5959; - --prism-property: #b58451; - --prism-namespace: #b05a78; - --prism-punctuation: #8e8f8b; - --prism-decorator: #bd8f8f; - --prism-regex: #ab5e3f; - --prism-json-property: #698c96; -} - -html.dark { - --prism-foreground: #d4cfbf; - --prism-background: #1b1b1b; - --prism-comment: #758575; - --prism-string: #d48372; - --prism-literal: #429988; - --prism-keyword: #4d9375; - --prism-boolean: #1c6b48; - --prism-number: #6394bf; - --prism-variable: #c2b36e; - --prism-function: #a1b567; - --prism-deleted: #a14f55; - --prism-class: #54b1bf; - --prism-builtin: #e0a569; - --prism-property: #dd8e6e; - --prism-namespace: #db889a; - --prism-punctuation: #858585; - --prism-decorator: #bd8f8f; - --prism-regex: #ab5e3f; - --prism-json-property: #6b8b9e; - --prism-line-number: #888888; - --prism-line-number-gutter: #eeeeee; - --prism-line-highlight-background: #444444; - --prism-selection-background: #444444; -} - -pre[class*='language-'] { - @apply p-2; -} - -:not(pre) > code { - font-size: 0.9em; - background: var(--prism-background); - @apply font-light px-2 py-0.7 rounded; -} diff --git a/styles/index.ts b/styles/index.ts index 65e69b1..1765f7d 100644 --- a/styles/index.ts +++ b/styles/index.ts @@ -1,4 +1,3 @@ // inherit from base layouts, remove it to get full customizations import '@slidev/client/styles/layouts-base.css'; import './layout.css'; -import './code.css';