# @lantian1998/markdown-it-highlightjs

> Preset to use highlight.js with markdown-it.

Latest version **3.2.0** (published 2020-08-05) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install @lantian1998/markdown-it-highlightjs
pnpm add @lantian1998/markdown-it-highlightjs
yarn add @lantian1998/markdown-it-highlightjs
bun add @lantian1998/markdown-it-highlightjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2020-08-05 |
| First published | 2020-08-05 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Valérian Galliat |
| Maintainers | lantian1998 |
| Keywords | markdown-it-plugin |

## Links

- npm: https://www.npmjs.com/package/@lantian1998/markdown-it-highlightjs
- Repository: https://github.com/lantian1998/markdown-it-highlightjs
- Homepage: https://github.com/valeriangalliat/markdown-it-highlightjs
- Issues: https://github.com/lantian1998/markdown-it-highlightjs/issues
- npm.io page: https://npm.io/package/@lantian1998/markdown-it-highlightjs

## Dependencies (3)

- [lodash.flow](https://npm.io/package/lodash.flow.md) ^3.5.0
- [highlight.js](https://npm.io/package/highlight.js.md) ^9.18.1
- [html-entities](https://npm.io/package/html-entities.md) ^1.2.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 3.2.0 (latest) — 2020-08-05

## README

# markdown-it-highlightjs [![npm version](http://img.shields.io/npm/v/markdown-it-highlightjs.svg?style=flat-square)](https://www.npmjs.org/package/markdown-it-highlightjs)

> Preset to use [highlight.js] with [markdown-it].

[highlight.js]: https://highlightjs.org/
[markdown-it]: https://github.com/markdown-it/markdown-it

Usage
-----

```js
const md = require('markdown-it')()
  .use(require('markdown-it-highlightjs'), opts)

// All code blocks will be highlighted.
```

The `opts` object can contain:

Name       | Type | Description                                                                | Default
-----------|------|----------------------------------------------------------------------------|--------
`auto`     | boolean | Whether to automatically detect language if not specified.              | `true`
`code`     | boolean | Whether to add the `hljs` class to raw code blocks (not fenced blocks). | `true`
`register` | object  | Register other languages which are not included in the standard pack.   | `null`
`inline`   | boolean | Whether to highlight inline code.                                       | `false`

### Register languages

```js
const md = require('markdown-it')()
  .use(require('markdown-it-highlightjs'), {
    register: {
      cypher: require('highlightjs-cypher')
    }
  })
```

### Inline code highlighting

You can enable inline code highlighting by setting `inline` to true:

```js
const md = require('markdown-it')()
  .use(require('markdown-it-highlightjs'), { inline: true })
```

You can specify the language for inline code using [Pandoc syntax](https://pandoc.org/MANUAL.html#extension-inline_code_attributes):

```markdown
`x=4`{.js}
```

or [Kramdown IAL syntax](https://kramdown.gettalong.org/syntax.html#inline-attribute-lists):

```markdown
`x=4`{:.js}
```

If you do not specify a language, then highlight.js will attempt to guess the language if `auto` is true (which it is by default).

---
_Source: https://npm.io/package/@lantian1998/markdown-it-highlightjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
