1.2.11 ā€¢ Published 12 days ago

svelte-highlight-switcher v1.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

svelte-highlight-switcher

šŸ“ Safe svelte-highlight dynamic style switching

Demo

Hides the use of @html and reduces the risk of XSS.

Installation

npm i svelte-highlight-switcher

Example

<script>
  import { HighlightSwitcher } from 'svelte-highlight-switcher'

  let isDarkMode = false
</script>

<HighlightSwitcher name={isDarkMode ? 'githubDark' : 'github'} />

ā†“ This is equivalent to the following code

<script>
  import * as styles from 'svelte-highlight/styles'

  let isDarkMode = false
</script>

<svelte:head>
  {@html isDarkMode ? styles['githubDark'] : styles['github']}
</svelte:head>

As long as the contents of svelte-highlight/styles are secure, there is no risk of XSS.

License

MIT

1.2.11

12 days ago

1.2.10

1 month ago

1.2.9

1 month ago

1.2.8

1 month ago

1.2.7

2 months ago

1.2.6

2 months ago

1.2.5

3 months ago

1.2.4

4 months ago

1.2.3

4 months ago

1.2.2

4 months ago

1.2.1

5 months ago

1.2.0

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago

0.0.1

5 months ago