Skip to content

Conversation

metonym
Copy link
Owner

@metonym metonym commented Oct 5, 2024

Alternative to #349 that uses component composition.

<script lang="ts">
  import { Highlight, ScopedStyle } from "svelte-highlight";
  import typescript from "svelte-highlight/languages/typescript";
  import atomOneDark from "svelte-highlight/styles/atom-one-dark.scoped";
  import github from "svelte-highlight/styles/github.scoped";
  import blackMetalDarkFuneral from "svelte-highlight/styles/black-metal-dark-funeral.scoped";

  const code = "const add = (a: number, b: number) => a + b;";
</script>

<ScopedStyle {...atomOneDark}>
  <Highlight language={typescript} {code} />
</ScopedStyle>

<ScopedStyle {...github}>
  <Highlight language={typescript} {code} />
</ScopedStyle>

<ScopedStyle {...blackMetalDarkFuneral}>
  <Highlight language={typescript} {code} />
</ScopedStyle>

@metonym metonym changed the title feat(styles): support scoped styles feat(styles): support scoped styles (alt) Feb 9, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant