All Projects → MakeNowJust → h.js

MakeNowJust / h.js

Licence: MIT license
2KB JavaScript Syntax Highlighter

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
CSS
56736 projects

Projects that are alternatives of or similar to h.js

Dot Hugo Documentation Theme
Dot - Hugo Documentation Theme
Stars: ✭ 162 (+337.84%)
Mutual labels:  syntax-highlighting, minimal
ZenScript
Visual Studio Code extension/Language Server for ZenScript, includes highlight, code snippet and language server(WIP). Works with 👇
Stars: ✭ 29 (-21.62%)
Mutual labels:  syntax-highlighting
django-andablog
A blog app that is only intended to be embedded within an existing Django site.
Stars: ✭ 27 (-27.03%)
Mutual labels:  minimal
Launcher
🚀 A distraction-free minimal homescreen for Android.
Stars: ✭ 116 (+213.51%)
Mutual labels:  minimal
lslforge
LSLForge - Eclipse plugin to assist with LSL scripting for Second Life. This repository is used for development, pull requests and bug reports.
Stars: ✭ 17 (-54.05%)
Mutual labels:  syntax-highlighting
ByteCopy
Simple C99 program and API for copying files.
Stars: ✭ 16 (-56.76%)
Mutual labels:  minimal
potato-dark
Dark and elegant blog theme for goHugo static site generator.
Stars: ✭ 21 (-43.24%)
Mutual labels:  minimal
vim-SystemVerilog
SystemVerilog syntax highlight/indent support in vim
Stars: ✭ 37 (+0%)
Mutual labels:  syntax-highlighting
KeyLighter
Yet another syntax highlighter for PHP
Stars: ✭ 29 (-21.62%)
Mutual labels:  syntax-highlighting
PlantUml-Language-Service
PlantUml Language Service extension for Visual Studio 2017 and 2019
Stars: ✭ 24 (-35.14%)
Mutual labels:  syntax-highlighting
Gesko
Gesko is a simple and minimalistic jekyll blogging theme.
Stars: ✭ 147 (+297.3%)
Mutual labels:  minimal
xmlspectrum
XSLT 2.0 coded syntax highlighter for XSLT 3.0, XPath 3.0...
Stars: ✭ 46 (+24.32%)
Mutual labels:  syntax-highlighting
plyr
A hyperminimal, lightweight macOS desktop music application
Stars: ✭ 48 (+29.73%)
Mutual labels:  minimal
Assembly-Syntax-Definition
This is the greatest syntax definition of All Time
Stars: ✭ 23 (-37.84%)
Mutual labels:  syntax-highlighting
violet
🔮 Violet Jekyll Template
Stars: ✭ 38 (+2.7%)
Mutual labels:  minimal
geshi-1.1
Next generation of Generic Syntax Highlighter for PHP
Stars: ✭ 70 (+89.19%)
Mutual labels:  syntax-highlighting
creators-code
A minimal alternative for other codes of conduct I have seen.
Stars: ✭ 46 (+24.32%)
Mutual labels:  minimal
hyper-rose-pine-next
Hyper Theme - which supports your System Preferences
Stars: ✭ 28 (-24.32%)
Mutual labels:  minimal
iterm-oh-my-zsh-powerlevel10k
Improved Terminal Experience with Oh My Zsh, iTerm2, PowerLevel10K
Stars: ✭ 24 (-35.14%)
Mutual labels:  syntax-highlighting
SublimeText-GameMaker-Plugin
GML Snippets & Syntax Highlighting for SublimeText 2
Stars: ✭ 20 (-45.95%)
Mutual labels:  syntax-highlighting

h.js

2KB JavaScript Syntax Highlighter

Version MIT License SUSHI-WARE License

Features

  • Small. The size is only 2.0KB or 1.4KB if gzipped.
  • Dependency free. It needs no other libraries.
  • It supports ES2021 syntax.

Install

NPM:

$ npm install h.js

Yarn:

$ yarn add h.js

Usage

const h = require("h.js");

console.log(h("1 + 2"));
// => <span class=v>1</span> <span class=o>+</span> <span class=v>2</span>

API

/**
 * `h` highlights JavaScript source code.
 *
 * @param {string} source - JavaScript source code
 * @return {string} - highlighted HTML string
 */
const h = source => ...

It returns an HTML string which contains some <span> elements having such classes:

  • <span class=c>...</span>: comment
  • <span class=d>...</span>: JSDoc tag (only in comment)
  • <span class=k>...</span>: keyword
  • <span class=v>...</span>: value (number literal, boolean and some constants)
  • <span class=s>...</span>: string literal (also means a template string)
  • <span class=i>...</span>: interpolation content (only in template string)
  • <span class=r>...</span>: regexp literal
  • <span class=o>...</span>: operator symbol
  • <span class=p>...</span>: punctual symbol
  • <span class=f>...</span>: function name

License

MIT and 🍣

(C) 2015-2022 TSUYUSATO "MakeNowJust" Kitsune

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].