# compromise-align

> smart-replace plugin for nlp-compromise

Latest version **0.0.2** (published 2020-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install compromise-align
pnpm add compromise-align
yarn add compromise-align
bun add compromise-align
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-01-27 |
| First published | 2020-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 30.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Spencer Kelly |
| Maintainers | spencermountain |

## Links

- npm: https://www.npmjs.com/package/compromise-align
- Repository: https://github.com/spencermountain/compromise-align
- Homepage: https://github.com/spencermountain/compromise-align#readme
- Issues: https://github.com/spencermountain/compromise-align/issues
- npm.io page: https://npm.io/package/compromise-align

## Dependencies (2)

- [htm](https://npm.io/package/htm.md) 3.0.1
- [vhtml](https://npm.io/package/vhtml.md) 2.2.0

## Recent versions

- 0.0.2 (latest) — 2020-01-27
- 0.0.1 — 2020-01-27

## README

<div align="center">
  <img src="https://cloud.githubusercontent.com/assets/399657/23590290/ede73772-01aa-11e7-8915-181ef21027bc.png" />

  <div>a plugin for <a href="https://github.com/spencermountain/compromise/">compromise</a></div>
  
  <!-- npm version -->
  <a href="https://npmjs.org/package/compromise-align">
    <img src="https://img.shields.io/npm/v/compromise-align.svg?style=flat-square" />
  </a>
  
  <!-- file size -->
  <a href="https://unpkg.com/compromise-align/builds/compromise-align.min.js">
    <img src="https://badge-size.herokuapp.com/spencermountain/compromise-align/master/builds/compromise-align.min.js" />
  </a>
   <hr/>
</div>

<div align="center">
  <code>npm install compromise-align</code>
</div>

```js
const nlp = require('compromise')
nlp.extend(require('compromise-align'))

let doc = nlp(myNovel)
let html = doc.htmlAlign('the #Adjective of times')
document.querySelector('#myId').innerHTML = html
```

generate html output to line-up matches in a text, for easy viewing.

### [Demo](http://spencermounta.in/compromise-align/)

### Usage

in terms of CSS styling, it does most of the layout, and tags the middle text as `.matchText`.
You can style it however you'd like.

the method returns html-strings by default, but the library uses [Jason Miller's htm library](https://github.com/developit/htm) so you can return React Components, or anything:

```js
doc.htmlAlign(
  {},
  {
    bind: React.createElement,
  }
)
```

work-in-progress

MIT

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