Skip to content
New issue

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

Custom <pre> class name? #206

Closed
FredKSchott opened this issue Aug 23, 2021 · 1 comment · Fixed by #384
Closed

Custom <pre> class name? #206

FredKSchott opened this issue Aug 23, 2021 · 1 comment · Fixed by #384

Comments

@FredKSchott
Copy link
Contributor

FredKSchott commented Aug 23, 2021

In Astro, we'd love to power our new built-in <Code> component with Shiki (to eventually replace our current built-in <Prism> component).

However, we would like to keep shikli as an implementation detail, and not leak the class="shiki" attribute onto the <pre> element if possible.

Is this something that you / the team is interested in adding as a configuration value to codeToHtml() to customize the <pre> class name that gets added? If so, I'm happy to provide the PR.

@orta
Copy link
Contributor

orta commented Aug 26, 2021

I'm assuming we're talking about this:

html += `<pre class="shiki" style="background-color: ${bg}">`

I think I'd be cool with that being a configuration option like wrapperClasses of some sort, which is an array, with the default as ["shiki"]. Then you could pass in wrapperClasses: [] to not have any.

Extra win is that the default is something like: ["shiki", "$theme-name"] which adds the theme name OOTB so that the multi-render concept could be less work for other people too if they don't go the CSS vars route mentioned in #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants