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

@speed-highlight/core

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@speed-highlight/core

🌈 Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection

  • 1.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
increased by449.81%
Maintainers
1
Weekly downloads
 
Created
Source

Speed-highlight JS

Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection, try it out here

Light 📦

  • The core is about 1kB (gzipped & minified)
  • Languages definition are from a few bytes to 1kB
  • Themes are about 1kB
  • Language rules needed are automatically loaded

Fast ⚡

Blazing fast highlighting using regex

Simple setup 🚀

Web

Style/theme (in the header of your html file):

<link rel="stylesheet" href="/path/dist/themes/default.css">

In the body of your html file:

<div class='shj-lang-[code-language]'>[code]</div>
or
<code class='shj-lang-[code-language]'>[inline code]</code>

Highlight the code (in your javascript):

import { highlightAll } from '/path/dist/index.js'
highlightAll();

Auto language detection

import { highlightElement } from '../src/index.js';
import { detectLanguage } from '../src/detect.js';

elm.textContent = code;
highlightElement(elm, detectLanguage(code));
CDN
<link rel="stylesheet" href="https://unpkg.com/@speed-highlight/core/dist/themes/default.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/speed-highlight/core/dist/themes/default.css">
import ... from 'https://unpkg.com/@speed-highlight/core/dist/index.js'
import ... from 'https://cdn.jsdelivr.net/gh/speed-highlight/core/dist/index.js'

Deno

Use the deno module

import { setTheme, printHighlight } from 'https://x.nest.land/speed_highlight_js/dist/term.js';

await setTheme('default');
printHighlight('console.log("hello")', 'js');

Node

Use the npm package

npm i @speed-highlight/core
const { setTheme, printHighlight } = require('@speed-highlight/core/dist/node/term.js');

setTheme('default')
printHighlight('console.log("hello")', 'js');

Languages supported 🌐

NameClass nameSupportLanguage detection
bashshj-lang-bash
brainfuckshj-lang-bfincrement, operator, print, comment
cssshj-lang-csscomment, str, selector, units, function, ...
csvshj-lang-csvpunctuation, ...
diffshj-lang-diff
gitshj-lang-gitcomment, insert, deleted, string, ...
htmlshj-lang-html
httpshj-lang-httpkeywork, string, punctuation, variable, version
inishj-lang-ini
javasciptshj-lang-jsbasic syntax, regex, jsdoc, json, template literals
jsdocshj-lang-jsdoc
jsonshj-lang-jsonstring, number, bool, ...
leanpub-mdshj-lang-leanpub-md
logshj-lang-lognumber, string, comment, errors
luashj-lang-lua
makefileshj-lang-make
markdownshj-lang-md
perlshj-lang-pl
plainshj-lang-plain
pythonshj-lang-py
regexshj-lang-regexcount, set, ...
sqlshj-lang-sqlnumber, string, function, ...
todoshj-lang-todo
tomlshj-lang-tomlcomment, table, string, bool, variable
typescriptshj-lang-tsjs syntax, ts keyword, types
urishj-lang-uri
yamlshj-lang-yamlcomment, numbers, variable, string, bool
dockershj-lang-docker
cshj-lang-c
xmlshj-lang-xml
rustshj-lang-rs
goshj-lang-go
javashj-lang-java
asmshj-lang-asm

Themes 🌈

A modern theme by default

NameTerminalWeb
default
github-dark
github-light
github-dim
atom-dark
visual-studio-dark

Wiki 👀

Further in-depth documentation for the API and other topics is in our Wiki

License 📃

Shj is released under the Creative Commons Zero License. See our LICENSE file for details.

Keywords

FAQs

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