# @editorjs/code

> Code Tool for Editor.js

Latest version **2.9.4** (published 2025-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @editorjs/code
pnpm add @editorjs/code
yarn add @editorjs/code
bun add @editorjs/code
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.9.4 |
| Published | 2025-12-19 |
| First published | 2019-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 85 |
| Author | CodeX Team |
| Maintainers | codex-team |
| Keywords | codex editor, code, editor.js, editorjs |

## Links

- npm: https://www.npmjs.com/package/@editorjs/code
- Repository: https://github.com/editor-js/code
- npm.io page: https://npm.io/package/@editorjs/code

## Dependencies (1)

- [@codexteam/icons](https://npm.io/package/@codexteam/icons.md) ^0.3.2

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.9.4 (latest) — 2025-12-19
- 2.9.3 — 2024-11-19
- 2.9.2 — 2024-09-18
- 2.9.0 — 2023-11-16
- 2.8.0 — 2022-11-29
- 2.7.0 — 2021-03-12
- 2.6.0 — 2020-09-29
- 2.5.0 — 2020-06-05
- 2.4.1 — 2019-03-31
- 2.4.0 — 2019-03-01

## README

![](https://badgen.net/badge/Editor.js/v2.0/blue)

# Code Tool for Editor.js

Code Tool for the [Editor.js](https://ifmo.su/editor) allows to include code examples in your articles.

![](assets/68747470733a2f2f636170656c6c612e706963732f38646630323266352d623464352d346433302d613532372d3261306566623633663239312e6a7067.jpeg)

## Installation

Get the package

```shell
yarn add @editorjs/code
```

Include module at your application

```javascript
import CodeTool from '@editorjs/code';
```

Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/code@latest)

## Usage

Add a new Tool to the `tools` property of the Editor.js initial config.

```javascript
var editor = EditorJS({
  ...

  tools: {
    ...
    code: CodeTool,
  }

  ...
});
```

## Config Params

| Field       | Type     | Description                    |
| ----------- | -------- | -------------------------------|
| placeholder | `string` | Code Tool's placeholder string |

## Output data

This Tool returns code.

```json
{
    "type" : "code",
    "data" : {
        "code": "body {\n font-size: 14px;\n line-height: 16px;\n}",
    }
}
```

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