# smart-chunks

> Smart Chunks are intelligently designed to maximize their value as inputs into embedding models.

Latest version **0.1.12** (published 2024-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install smart-chunks
pnpm add smart-chunks
yarn add smart-chunks
bun add smart-chunks
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2024-04-11 |
| First published | 2023-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 57.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 114 |
| Author | Brian Joseph Petro |
| Maintainers | wfhbrian |
| Keywords | embedding, chunking, markdown, parser |

## Links

- npm: https://www.npmjs.com/package/smart-chunks
- Repository: https://github.com/brianpetro/jsbrains
- Homepage: https://jsbrains.org
- Issues: https://github.com/brianpetro/jsbrains/issues
- npm.io page: https://npm.io/package/smart-chunks

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

- 0.1.12 (latest) — 2024-04-11
- 0.1.11 — 2024-01-31
- 0.1.10 — 2024-01-02
- 0.1.9 — 2023-12-21
- 0.1.8 — 2023-12-20
- 0.1.7 — 2023-12-20
- 0.1.4 — 2023-12-16
- 0.1.3 — 2023-12-12
- 0.1.2 — 2023-12-12
- 0.1.1 — 2023-12-12
- 0.1.0 — 2023-12-12

## README

# Smart Chunks
Smart Blocks (chunks) are intelligently designed chunks used to maximize the value of inputs into embedding models.

## installation
```
npm install smart-chunks
```

## usage

### SmartMarkdown

```js
const { SmartMarkdown } = require('smart-chunks');
const smart_markdown = new SmartMarkdown(optional_config);
const blocks = smart_markdown.parse({
  content: `# Heading 1\ntext\n## Heading 2\ntext`, // some markdown content
  file_path: './path/to/file.md', // optional: used to improve breadcrumbs (chunk context)
});
```

### blocks

`blocks` is an array of objects with the following properties:

- `text`: the text of the block
- `path`: the path of the block (e.g. `./path/to/file.md#heading1#heading2`)
- `length`: the length of the block in characters

## about
Designed for use with [Smart Connections](https://smartconnections.app) Obsidian plugin.

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