mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-09-02 00:38:49 +02:00
docs(api): Update nitro to latest version (#4102)
* update nitro * try this? * Try this * update vercel output * Add await * Fix endpoints * Adjust 404 catch all * Fix output * Adjust react in api * Fix types * Remove @resvg/resvg-wasm * Format code * Fix failing check * Apply feedback * Format code
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { bundledLanguages, type ThemeRegistration } from 'shiki';
|
||||
import { createHighlighter } from 'shiki';
|
||||
import { highLightCode } from './createCodeExamples';
|
||||
|
||||
type CodeExampleType = {
|
||||
title: string;
|
||||
@@ -116,34 +115,6 @@ import { $CamelCase } from '@lucide/lab';
|
||||
];
|
||||
};
|
||||
|
||||
export type ThemeOptions =
|
||||
| ThemeRegistration
|
||||
| { light: ThemeRegistration; dark: ThemeRegistration };
|
||||
|
||||
const highLightCode = async (code: string, lang: string, active?: boolean) => {
|
||||
const highlighter = await createHighlighter({
|
||||
themes: ['github-light', 'github-dark'],
|
||||
langs: Object.keys(bundledLanguages),
|
||||
});
|
||||
|
||||
const highlightedCode = highlighter
|
||||
.codeToHtml(code, {
|
||||
lang,
|
||||
themes: {
|
||||
light: 'github-light',
|
||||
dark: 'github-dark',
|
||||
},
|
||||
defaultColor: false,
|
||||
})
|
||||
.replace('shiki-themes', 'shiki-themes vp-code');
|
||||
|
||||
return `<div class="language-${lang} ${active ? 'active' : ''}">
|
||||
<button title="Copy Code" class="copy"></button>
|
||||
<span class="lang">${lang}</span>
|
||||
${highlightedCode}
|
||||
</div>`;
|
||||
};
|
||||
|
||||
export default async function createCodeExamples() {
|
||||
const codes = getIconCodes();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user