# @acarl005/codeflask

> A micro code-editor for awesome web pages

Latest version **2.1.6** (published 2022-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @acarl005/codeflask
pnpm add @acarl005/codeflask
yarn add @acarl005/codeflask
bun add @acarl005/codeflask
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.6 |
| Published | 2022-09-16 |
| First published | 2022-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1115 |
| Author | Claudio Holanda |
| Maintainers | acarl005 |
| Keywords | code-editor, code, syntax-highlight, highlight |

## Links

- npm: https://www.npmjs.com/package/@acarl005/codeflask
- Repository: https://github.com/kazzkiq/CodeFlask
- Homepage: https://kazzkiq.github.io/CodeFlask/
- Issues: https://github.com/kazzkiq/CodeFlask/issues
- npm.io page: https://npm.io/package/@acarl005/codeflask

## Dependencies (1)

- [@types/prismjs](https://npm.io/package/@types/prismjs.md) ^1.9.1

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 2.1.6 (latest) — 2022-09-16
- 2.1.5 — 2022-09-14
- 2.1.4 — 2022-09-01
- 2.1.3 — 2022-08-31
- 2.1.2 — 2022-08-31
- 2.1.1 — 2022-07-25
- 2.1.0 — 2022-07-17
- 2.0.9 — 2022-05-10
- 2.0.8 — 2022-03-30
- 2.0.7 — 2022-03-27
- 2.0.6 — 2022-03-26
- 2.0.5 — 2022-03-17
- 2.0.4 — 2022-03-17
- 2.0.3 — 2022-03-17
- 2.0.2 — 2022-03-16
- … 3 more at https://npm.io/package/@acarl005/codeflask/versions

## README

# CodeFlask Mod

```bash
npm i '@acarl005/codeflask'
```

I modified [CodeFlask](https://github.com/kazzkiq/CodeFlask) to be able to...

1. Make PrismJS a peer dependency
1. Attach (and remove) custom event listeners to the editor
1. Support the [Line Highlight](https://prismjs.com/plugins/line-highlight/) plugin in PrismJS
1. Fix this issue: kazzkiq/CodeFlask#69
1. Fix bugs with tab hotkey for indentation
1. Make the self-closing characters configurable

```javascript
import CodeFlask from "codeflask"
import Prism from "prismjs"

const flask = new CodeFlask(editor, Prism, {
  language: "js",
  selfClosingCharacters: ['(', '[', '{', "'", '"'],
  customEventListeners: {
    "keydown": e => {
      if (e.key == "Enter") {
        e.preventDefault()
        e.stopImmediatePropagation()
        // do custom stuff
      }
    }
  }
})

flask.highlightLines("4-7")
```

PrismJS is highly customizable.
It actually offers custom builds with more plugins that you can opt into.
This is an awesome and rare feature b/c you can minimize the bundle by omitting unneeded functionality.
Therefore, it should be a peer dependency, b/c CodeFlask can't know which build with which plugins you'll need.

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