Skip to content

Commit

Permalink
docs: move to js shiki engine
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Aug 30, 2024
1 parent 305d88c commit a6e8bdf
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 47 deletions.
5 changes: 4 additions & 1 deletion docs/stores/shiki.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import type { HighlighterCore } from 'shiki'

import { createJavaScriptRegexEngine, getSingletonHighlighter } from 'shiki'
import { computed, onMount, atom, task } from 'nanostores'
import { getSingletonHighlighter } from 'shiki'

import { colorTheme } from '../utils/shiki-theme'

let shikiHighlighter = atom<HighlighterCore | null>(null)

let jsEngine = createJavaScriptRegexEngine()

export let shiki = computed([shikiHighlighter], highlighter => ({
theme: 'css-variables',
highlighter,
Expand All @@ -24,6 +26,7 @@ onMount(shikiHighlighter, () => {
import('shiki/langs/js.mjs'),
],
themes: [colorTheme],
engine: jsEngine,
})

shikiHighlighter.set(highlighter)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"@nanostores/vue": "^0.10.0",
"@playform/compress": "^0.1.1",
"@poppanator/sveltekit-svg": "5.0.0-svelte5.3",
"@shikijs/transformers": "^1.14.1",
"@shikijs/transformers": "^1.15.0",
"@types/eslint": "^9.6.1",
"@types/mdast": "^4.0.4",
"@types/natural-compare-lite": "^1.4.2",
Expand Down Expand Up @@ -131,7 +131,7 @@
"prettier-plugin-svelte": "^3.2.6",
"rehype-external-links": "^3.0.0",
"remark-sectionize": "^2.0.0",
"shiki": "^1.14.1",
"shiki": "^1.15.0",
"shiki-magic-move": "^0.4.4",
"simple-git-hooks": "^2.11.1",
"stylelint": "^16.8.2",
Expand Down
Loading

0 comments on commit a6e8bdf

Please sign in to comment.