1.2.18 • Published 9 months ago

svelte-highlight-switcher v1.2.18

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months 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.18

9 months ago

1.2.16

9 months ago

1.2.17

9 months ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.14

12 months ago

1.2.15

11 months ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago