Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-highlight-switcher

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-highlight-switcher

📍 Safe svelte-highlight dynamic style switching

  • 1.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
786
decreased by-71.79%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-highlight-switcher

npm-version npm-license npm-download-month npm-min-size ci.yml website

📍 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

Keywords

FAQs

Package last updated on 26 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc