We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src
Hi, first of all thanks for the work. This is a hero for the project that I'm working on.
I am trying write my own wrapper because I want to use shiki as the syntax highlighter. This is what I have so far:
shiki
<script module> import { createHighlighter } from 'shiki'; const _highlighter = await createHighlighter({ themes: ['poimandres'], langs: ['svelte'] }); await _highlighter.loadLanguage('svelte'); /** * @param {string} code * @param {string} lang */ function highlighter(code, lang = 'svelte') { const html = _highlighter.codeToHtml(code, { lang, theme: 'poimandres' }); return html; } </script> <script> let { src = undefined, meta = undefined, example, code } = $props(); </script> <div class="my-8"> <div class="flex flex-col w-full rounded-b-md"> <div class="flex justify-center shadow-inner rounded-t-md"> <div class="flex justify-center items-center min-h-12 py-4"> {@render example?.()} </div> </div> {@html highlighter(src)} </div> </div> <style> :global(pre) { margin: 0; } </style>
It works, except code indentation is gone. Is there any way to preserve code indentation as the default wrapper does?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, first of all thanks for the work. This is a hero for the project that I'm working on.
I am trying write my own wrapper because I want to use
shiki
as the syntax highlighter. This is what I have so far:It works, except code indentation is gone. Is there any way to preserve code indentation as the default wrapper does?
The text was updated successfully, but these errors were encountered: