Socket
Socket
Sign inDemoInstall

lowlight

Package Overview
Dependencies
1
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.0 to 1.9.0

2

index.js

@@ -101,2 +101,3 @@ /**

low.registerLanguage('julia', require('highlight.js/lib/languages/julia'));
low.registerLanguage('julia-repl', require('highlight.js/lib/languages/julia-repl'));
low.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin'));

@@ -151,2 +152,3 @@ low.registerLanguage('lasso', require('highlight.js/lib/languages/lasso'));

low.registerLanguage('roboconf', require('highlight.js/lib/languages/roboconf'));
low.registerLanguage('routeros', require('highlight.js/lib/languages/routeros'));
low.registerLanguage('rsl', require('highlight.js/lib/languages/rsl'));

@@ -153,0 +155,0 @@ low.registerLanguage('ruleslanguage', require('highlight.js/lib/languages/ruleslanguage'));

8

package.json
{
"name": "lowlight",
"version": "1.8.0",
"version": "1.9.0",
"description": "Virtual syntax highlighting for virtual DOMs and non-HTML things",

@@ -27,3 +27,3 @@ "license": "MIT",

"dependencies": {
"highlight.js": "~9.11.0"
"highlight.js": "~9.12.0"
},

@@ -35,5 +35,5 @@ "devDependencies": {

"rehype": "4.0.0",
"nyc": "^10.0.0",
"nyc": "^11.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^2.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.0.0",

@@ -40,0 +40,0 @@ "unist-util-visit": "^1.0.0",

@@ -8,3 +8,3 @@ # lowlight [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

Lowlight is built to work with all syntaxes supported by [highlight.js][],
that’s [174 languages][names] (and all 73 themes).
that’s [176 languages][names] (and all 73 themes).

@@ -16,5 +16,6 @@ ## Table of Contents

* [API](#api)
* [low.registerLanguage(name, syntax)](#lowregisterlanguagename-syntax)
* [low.highlight(language, value\[, options\])](#lowhighlightlanguage-value-options)
* [low.highlightAuto(value\[, options\])](#lowhighlightautovalue-options)
* [low.registerLanguage(name, syntax)](#lowregisterlanguagename-syntax)
* [Result](#result)
* [Browser](#browser)

@@ -71,24 +72,19 @@ * [Projects](#projects)

### `low.registerLanguage(name, syntax)`
Register a [syntax][] as `name` (`string`). Useful in the browser or with
custom grammars.
### `low.highlight(language, value[, options])`
Parse `value` according to the `language` grammar.
Parse `value` (`string`) according to the [`language`][names] grammar.
##### Parameters
###### `options`
* `name` (`string`) — See list of [names and aliases][names];
* `value` (`string`) — Source to highlight;
* `options` (`Object?`, optional):
* `prefix` (`string?`, default: `'hljs-'`) — Class prefix.
* `prefix` (`string?`, default: `'hljs-'`) — Class prefix
###### Returns
`Object`:
[`Result`][result].
* `relevance` (`number`)
— Integer representing how sure **low** is the given code is in
the given language;
* `language` (`string`) — The given `language`;
* `value` ([`Array.<Node>`][hast-node]) — [Hast nodes][hast-node]
representing the highlighted given code.
### `low.highlightAuto(value[, options])`

@@ -98,37 +94,27 @@

###### Parameters
###### `options`
* `value` (`string`) — Source to highlight;
* `options` (`Object?`, optional):
* `prefix` (`string?`, default: `'hljs-'`)
— Class prefix;
* `subset` (`Array.<string>?`, optional, defaults to
all registered languages.)
— List of allowed languages.
* `prefix` (`string?`, default: `'hljs-'`) — Class prefix
* `subset` (`Array.<string>?` default: all registered languages) — List of
allowed languages
###### Returns
`Object`:
[`Result`][result], with a `secondBest` if found.
* `relevance` (`number`)
— Integer representing how sure **low** is the given code
is in the detected language;
* `language` (`string`) — The given `language`;
* `value` ([`Array.<Node>`][hast-node]) — [Hast nodes][hast-node]
representing the highlighted given code.
* `secondBest` (`Object?`)
— Object with the same structure as the top returned object, but
containing information for the second-best result.
Can be `null`.
### `Result`
### `low.registerLanguage(name, syntax)`
`Result` is a highlighting result object.
Register a syntax. Useful in the browser or with custom grammars.
###### Properties
###### Parameters
* `relevance` (`number`) — Integer representing how sure **low** is the given
code is in the given language
* `language` (`string`) — The detected `language`
* `value` ([`Array.<Node>`][hast-node]) — Virtual nodes representing the
highlighted given code
* `secondBest` ([`Result?`][result])
— Result of the second-best (based on `relevance`) match.
Only set by `highlightAuto`, but can still be `null`.
* `name` (`string`) — Name of language;
* `syntax` (`Function`) — Syntax highlighter, see
[`highlight.js`s docs][syntax] for more information.
## Browser

@@ -158,11 +144,11 @@

* [`emphasize`](https://github.com/wooorm/emphasize)
— Syntax highlighting in ANSI, for the terminal;
— Syntax highlighting in ANSI, for the terminal
* [`react-lowlight`](https://github.com/rexxars/react-lowlight)
— Syntax highlighter for [React][];
— Syntax highlighter for [React][]
* [`react-syntax-highlighter`](https://github.com/conorhastings/react-syntax-highlighter)
— [React][] component for syntax highlighting.
— [React][] component for syntax highlighting
* [`rehype-highlight`](https://github.com/wooorm/rehype-highlight)
— Syntax highlighting in [**rehype**](https://github.com/wooorm/rehype);
— Syntax highlighting in [**rehype**](https://github.com/wooorm/rehype)
* [`remark-highlight.js`](https://github.com/ben-eb/remark-highlight.js)
— Syntax highlighting in [**remark**](https://github.com/wooorm/remark);
— Syntax highlighting in [**remark**](https://github.com/wooorm/remark)

@@ -191,3 +177,3 @@ ## License

[hast-node]: https://github.com/wooorm/hast#nodes
[hast-node]: https://github.com/wooorm/hast#ast

@@ -207,1 +193,3 @@ [highlight.js]: https://github.com/isagalaev/highlight.js

[browser]: #browser
[result]: #result
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc