# dtext-parser

> DText parser library

Latest version **1.0.0** (published 2024-03-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install dtext-parser
pnpm add dtext-parser
yarn add dtext-parser
bun add dtext-parser
```

## 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 | 1.0.0 |
| Published | 2024-03-07 |
| First published | 2020-01-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.13.0 |
| Dependencies | 0 |
| Unpacked size | 28.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Saektide |
| Maintainers | saek_tide |
| Keywords | dtext, parser, e621 |

## Links

- npm: https://www.npmjs.com/package/dtext-parser
- Repository: https://github.com/e6Hub/dtext-parser
- Homepage: https://github.com/e6Hub/dtext-parser#readme
- Issues: https://github.com/e6Hub/dtext-parser/issues
- npm.io page: https://npm.io/package/dtext-parser

## 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.0 (latest) — 2024-03-07
- 0.5.0 — 2020-11-16
- 0.4.0 — 2020-04-28
- 0.3.1 — 2020-04-28
- 0.3.0 — 2020-01-09
- 0.2.0 — 2020-01-07
- 0.1.0 — 2020-01-06

## README

# DText parser
DText is the e621's markdown system, it's based on many languages like BBCode, MediaWiki, Textile, etc. This module parses DText to HTML.

## 📦 Install
```
npm i dtext-parser
```
or
```
pnpm add dtext-parser
```

## 🧪 Usage
### ⚡ Quick start
```js
const DText = require('dtext-parser');

DText.parse('h1.DText header')
  .then(console.log); // <h1>DText header</h1>
```

### ⚙ Config
Follow the name of the modules (codes) e.g. Bold, Italics, Code, External link, etc. then set your own class or style.
```js
const DText = require('dtext-parser');

DText.options({
    "External link": {
      attrs: [
        {
          name: 'style',
          value: 'color: red;'
        },
        {
          name: 'class',
          value: 'extern'
        }
      ]
    }
  });
});

DText.parse('https://github.com').then(console.log);
// <a href="https://github.com" class="extern" style="color: red;">https://github.com</a>
```

## 🧑‍💻 Build

1. Assuming you've already cloned this repo, install the packages with `pnpm i`.
2. Source code directory is `src/`, test unit files are located at `tests/`.
3. For unit testing, you can use `pnpm test`, for individual or playground testing, you can use the scripts of `playground/` directory.

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