Skip to content

Commit

Permalink
chore!: remove prism support (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX authored Sep 27, 2024
1 parent 3975f6e commit 01b35e4
Show file tree
Hide file tree
Showing 20 changed files with 13 additions and 401 deletions.
2 changes: 1 addition & 1 deletion demo/composable-vue/components/Marker.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<span class="bg-$prism-background px-2 py-1 rounded font-mono inline-block text-0.4em line-height-1em transform translate-y-[-1.5em] translate-x-[-0.3em]"><slot /></span>
<span class="bg-$slidev-code-background px-2 py-1 rounded font-mono inline-block text-0.4em line-height-1em transform translate-y-[-1.5em] translate-x-[-0.3em]"><slot /></span>
</template>
4 changes: 1 addition & 3 deletions docs/custom/config-highlighter.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,5 @@ For now, Shiki Magic Move does not support transformers.
## Configure Prism

:::warning
Prism support is deprecated and will be removed in the future. Please consider using Shiki instead.
Prism support has been removed since v0.50. Please use Shiki instead.
:::

To configure your Prism, you can just import the theme CSS or use [`prism-theme-vars`](https://github.com/antfu/prism-theme-vars) to configure themes for both light and dark mode. Refer to its docs for more details.
2 changes: 0 additions & 2 deletions docs/custom/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export:
dark: false
withClicks: false
withToc: false
# syntax highlighter, can be 'prism', 'shiki'
highlighter: shiki
# enable twoslash, can be boolean, 'dev' or 'build'
twoslash: true
# show line numbers in code blocks
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@types/katex": "catalog:",
"@types/markdown-it": "catalog:",
"@types/node": "catalog:",
"@types/prismjs": "catalog:",
"@types/prompts": "catalog:",
"@types/recordrtc": "catalog:",
"@types/resolve": "catalog:",
Expand Down
4 changes: 1 addition & 3 deletions packages/create-theme/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
"screenshot": "slidev export example.md --format png"
},
"dependencies": {
"@slidev/types": "^0.50.0-beta.1",
"prism-theme-vars": "^0.2.5"
"@slidev/types": "^0.50.0-beta.1"
},
"devDependencies": {
"@slidev/cli": "^0.50.0-beta.1"
},
"//": "Learn more: https://sli.dev/guide/write-theme.html",
"slidev": {
"colorSchema": "both",
"highlighter": "all",
"defaults": {
"fonts": {
"sans": "Nunito Sans",
Expand Down
2 changes: 0 additions & 2 deletions packages/create-theme/template/styles/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// inherit from base layouts, remove it to get full customizations
import '@slidev/client/styles/layouts-base.css'
import './layout.css'
// TODO: remove this in v0.50
import './prism.css'
49 changes: 0 additions & 49 deletions packages/create-theme/template/styles/prism.css

This file was deleted.

10 changes: 7 additions & 3 deletions packages/parser/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function getDefaultConfig(): SlidevConfig {

export function resolveConfig(headmatter: any, themeMeta: SlidevThemeMeta = {}, filepath?: string, verify = false) {
const themeHightlighter = ['prism', 'shiki', 'shikiji'].includes(themeMeta.highlighter || '')
? themeMeta.highlighter as 'prism' | 'shiki'
? themeMeta.highlighter as 'shiki'
: undefined
const themeColorSchema = ['light', 'dark'].includes(themeMeta.colorSchema || '')
? themeMeta.colorSchema as 'light' | 'dark'
Expand Down Expand Up @@ -82,6 +82,10 @@ export function resolveConfig(headmatter: any, themeMeta: SlidevThemeMeta = {},
config.highlighter = 'shiki'
}

// @ts-expect-error compat
if (config.highlighter === 'prism')
throw new Error(`[slidev] "prism" support has been dropped. Please use "highlighter: shiki" instead`)

if (config.colorSchema !== 'dark' && config.colorSchema !== 'light')
config.colorSchema = 'auto'
if (themeColorSchema && config.colorSchema === 'auto')
Expand All @@ -100,8 +104,8 @@ export function verifyConfig(
themeMeta: SlidevThemeMeta = {},
warn = (v: string) => console.warn(`[slidev] ${v}`),
) {
const themeHightlighter = ['prism', 'shiki'].includes(themeMeta.highlighter || '')
? themeMeta.highlighter as 'prism' | 'shiki'
const themeHightlighter = themeMeta.highlighter === 'shiki'
? themeMeta.highlighter as 'shiki'
: undefined
const themeColorSchema = ['light', 'dark'].includes(themeMeta.colorSchema || '')
? themeMeta.colorSchema as 'light' | 'dark'
Expand Down
1 change: 0 additions & 1 deletion packages/slidev/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { getRoots, isInstalledGlobally, resolveEntry } from './resolver'
import setupPreparser from './setups/preparser'

const CONFIG_RESTART_FIELDS: (keyof SlidevConfig)[] = [
'highlighter',
'monaco',
'routerMode',
'fonts',
Expand Down
5 changes: 0 additions & 5 deletions packages/slidev/node/syntax/markdown-it/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ export async function useMarkdownItPlugins(md: MarkdownIt, options: ResolvedSlid
if (config.highlighter === 'shiki') {
md.use(await MarkdownItShiki(options))
}
else {
console.warn('[Slidev] Highlighter: Prism highlighter is deprecated, and will be removed in v0.50. Refer to https://github.com/slidevjs/slidev/issues/1390')
const { default: MarkdownItPrism } = await import('./markdown-it-prism')
md.use(MarkdownItPrism)
}

md.use(MarkdownItLink)
md.use(MarkdownItEscapeInlineCode)
Expand Down
225 changes: 0 additions & 225 deletions packages/slidev/node/syntax/markdown-it/markdown-it-prism.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/slidev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"plantuml-encoder": "catalog:",
"postcss-nested": "catalog:",
"pptxgenjs": "catalog:",
"prismjs": "catalog:",
"prompts": "catalog:",
"public-ip": "catalog:",
"resolve-from": "catalog:",
Expand Down
2 changes: 0 additions & 2 deletions packages/slidev/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ theme: seriph
background: https://cover.sli.dev
# apply any unocss classes to the current slide
class: 'text-center'
# https://sli.dev/custom/config-highlighter.html
highlighter: shiki
# some information about the slides, markdown enabled
info: |
## Slidev Starter Template
Expand Down
Loading

0 comments on commit 01b35e4

Please sign in to comment.