New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sugar-high

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sugar-high

Super lightweight JSX syntax highlighter

  • 0.0.5
  • npm
  • Socket score

Version published
Weekly downloads
40K
decreased by-4.46%
Maintainers
1
Weekly downloads
 
Created
Source

Sugar High

Introduction

Super lightweight JSX syntax highlighter, around 1KB after minified and gzipped

⚠️ Still in experiment! Use it in production with caution!

Usage

npm install --save sugar-high
import { highlight } from 'sugar-high'

const codeHTML = highlight(code)

document.querySelector('pre > code').innerHTML = codeHTML

Highlight with CSS

Then make your own theme with customized colors and put in global CSS

/*
 * 0 - comment
 * 1 - keyword
 * 2 - break
 * 3 - string
 * 4 - space
 * 5 - sign
 * 6 - identifier
 * 7 - Class, number and null
 */
.sh__7 {
  color: #3476cb;
}
.sh__6 {
  color: #2d333b;
}
.sh__5 {
  color: #818c9b;
  font-weight: bold;
}
.sh__3 {
  color: #00a99a;
}
.sh__1 {
  color: #f47067;
}
.sh__0 {
  color: #818c9b;
}

LICENSE

MIT

FAQs

Package last updated on 30 Jan 2022

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