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

glowkit

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glowkit

Very lightweight but strong global syntax highlighting library.

  • 0.1.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Glowkit


Very lightweight (2kb) but strong global syntax highlighting library.

Getting Started

Installation

$ npm install glowkit
# or
$ pnpm add glowkit
# or
$ yarn add glowkit

Usage

import glowkit from "glowkit";

const myCode = `
import React from 'react';

const App = () => {
    return (
        <div>Hello, world!</div>
    )
}

export default App;
`;

const htmlResult = glowkit(myCode /* true */);

API

glowkit

Highlight code using Glowkit syntax highlighting.

export default function glowkit(str: string, noCss = false): string;
  • str

The code to highlight

  • noCss

Option for adding auto-css in the head.

default: false

Default Style

:root {
  --glowkit-bg-color: #282c34;
  --glowkit-color: #fff;
  --glowkit-border-radius: 4px;
  --glowkit-padding: 8px;
  --glowkit-font-size: 1.125rem;
  --glowkit-line-height: 1.75rem;
  --glowkit-font: monospace;
  --glowkit-keyword: #c678dd;
  --glowkit-operator: #b46fca;
  --glowkit-object-element: #f3727c;
  --glowkit-string: #56b6c2;
  --glowkit-object-last-element: #e5c07b;
}
.glowkit {
  background-color: var(--glowkit-bg-color);
  color: var(--glowkit-color);
  border-radius: var(--glowkit-border-radius);
  padding: var(--glowkit-padding);
  font-size: var(--glowkit-font-size);
  line-height: var(--glowkit-line-height);
  font-family: var(--glowkit-font);
  display: flex;
  flex-direction: column;
}

.glowkit > code * {
  font-weight: normal;
  color: #f1c97f;
}

.glowkit > code > strong.keyword {
  color: var(--glowkit-keyword);
}

.glowkit > code > i.operator {
  color: var(--glowkit-operator) !important;
}
.glowkit > code > .object_element {
  color: var(--glowkit-object-element);
}

.glowkit > code > .string {
  color: var(--glowkit-string);
}

.glowkit > code > .object_last_element {
  color: var(--glowkit-object-last-element);
}

LICENSE

The MIT License (MIT)

License

FAQs

Package last updated on 03 Mar 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