# cbparser

> A simple code block parser for extracting multiple codeblocks from text.

Latest version **1.0.5** (published 2022-06-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install cbparser
pnpm add cbparser
yarn add cbparser
bun add cbparser
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-06-05 |
| First published | 2022-05-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Rajnish Anand |
| Maintainers | rajnishanand |
| Keywords | discord, code, block, parser |

## Links

- npm: https://www.npmjs.com/package/cbparser
- Repository: https://github.com/RajnishAnand/CBParser
- Homepage: https://github.com/RajnishAnand/CBParser#readme
- Issues: https://github.com/RajnishAnand/CBParser/issues
- npm.io page: https://npm.io/package/cbparser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2022-06-05
- 1.0.4 — 2022-05-05
- 1.0.3 — 2022-05-04
- 1.0.2 — 2022-05-03
- 1.0.0 — 2022-05-03

## README

# CBParser : Code Block Parser
<img src="https://media.discordapp.net/attachments/906985861525155880/971070275523330078/cooltext410041309984105.png" width="100%" alt="banner"/>

![npm version](https://img.shields.io/npm/v/cbparser.svg?maxAge=3600)
![npm downloads](https://img.shields.io/npm/dt/cbparser.svg?maxAge=3600)
---
## About 
CBParser or Code Block parser is a parser to extract multiple code blocks from text, Specially Discord Code blocks.

- Completely Written in Typescript 🌟
- 0 Dependencies ✨
- Very Small in Size 🍫
- Easy to use 🍭

> `node ^v12` required.

## Installation 
Using npm:
```sh-session
npm install cbparser
```
using yarn:
```sh-session
yarn add cbparser
```
using pnpm:
```sh-session
pnpm add cbparser
```

## Importing
```js
const {CBParser} = require ('cbparser');
```
or using import :
```js
import {CBParser} from 'cbparser';
```

## Documentation:
**Parameter:**
- `str` : string 

**returns:**
- `Array<[Object]>`
  - `lang` ?: string
  - `code` : string

## Example:
code:
```js
const {CBParser} = require ('cbparser');

const code = "```js\nconsole.log('Hello Void!')```"
console.log(CBParser(code));
```
output:
```js
[{lang:"js", code: "console.log('Hello Void!')"}]
```
---
Check out [Regex](https://regexr.com/6krj0) being used to parse code blocks.

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