# @gylraj/code

> Custom Code Tool for Editor.js

Latest version **0.1.5** (published 2021-04-26) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2021-04-26 |
| First published | 2021-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | gian |
| Maintainers | gylraj |
| Keywords | codex editor, code, tool, editor.js, editorjs |

## Links

- npm: https://www.npmjs.com/package/@gylraj/code
- Repository: https://github.com/giansympher/code
- Homepage: https://github.com/giansympher/code#readme
- Issues: https://github.com/giansympher/code/issues
- npm.io page: https://npm.io/package/@gylraj/code

## 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

- 0.1.5 (latest) — 2021-04-26
- 0.1.4 — 2021-04-26
- 0.1.3 — 2021-04-26
- 0.1.2 — 2021-04-26
- 0.1.1 — 2021-04-26
- 0.1.0 — 2021-04-26
- 0.0.9 — 2021-04-23
- 0.0.8 — 2021-04-23
- 0.0.7 — 2021-04-23
- 2.7.0 — 2021-04-23

## 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.

![](https://capella.pics/8df022f5-b4d5-4d30-a527-2a0efb63f291.jpg)

## Installation

### Install via NPM

Get the package

```shell
npm i --save-dev @gylraj/code
```

Include module at your application

```javascript
const CustomCodeTool = require('@gylraj/code');
```

### Download to your project's source dir

1. Upload folder `dist` from repository
2. Add `dist/bundle.js` file to your page.

### Load from CDN

You can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@gylraj/code).

`https://cdn.jsdelivr.net/npm/@gylraj/code@2.0.0`

Require this script on a page with Editor.js.

```html
<script src="..."></script>
```

## Usage

Add a new Tool to the `tools` property of the Editor.js initial config.

```javascript
var editor = EditorJS({
  ...
  
  tools: {
    ...
    code: CustomCodeTool,
  }
  
  ...
});
```

## 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/@gylraj/code · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
