# remark-trim

> Remark plugin to trim unnecessary spaces from `strong`, `emphasis`, `inlineCode`, `image` and `url` nodes

Latest version **0.0.6** (published 2020-08-04) · 0 weekly downloads

## Install

```sh
npm install remark-trim
pnpm add remark-trim
yarn add remark-trim
bun add remark-trim
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2020-08-04 |
| First published | 2020-08-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrey Stepanov |
| Maintainers | andreystepanov |
| Keywords | remark, trim, plugin, spaces, whitespace, markdown |

## Links

- npm: https://www.npmjs.com/package/remark-trim
- Homepage: https://github.com/andreystepanov/remark-trim
- Issues: https://github.com/andreystepanov/remark-trim/issues
- npm.io page: https://npm.io/package/remark-trim

## Dependencies (1)

- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^2.0.3

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2020-08-04
- 0.0.5 — 2020-08-04
- 0.0.4 — 2020-08-03
- 0.0.3 — 2020-08-02
- 0.0.2 — 2020-08-01
- 0.0.1 — 2020-08-01

## README

# remark-trim

> [remark](https://github.com/remarkjs/remark) plugin to trim all unnecessary spaces in `strong`, `emphasis`, `inlineCode`, `url` and `image` nodes

## Installation

```
npm install remark-trim --save
```

## Usage

Say we have the following file, `example.md`:

<!-- prettier-ignore -->
````markdown
# Title

`code`

`code  with a  few  spaces`

`    const param = [ 1,   2,  3 ]    `

`const param = false`

```
const block =  true
```

Paragraph with ** bold ** text .

Paragraph with ** _ bold italic _ ** text :

Paragraph with [ link with  spaces ](https://link.com)

Paragraph with image ![  caption with  spaces    ](https://images.com/demo.png)

Paragraph with _ italic _ text.
````

And our script, `example.js`, looks as follows:

```javascript
const vfile = require('to-vfile')
const remark = require('remark')
const trim = require('remark-trim')

const markdown = remark()
  .use(trim)
  .use({ settings: { fences: true } })
  .process(vfile.readSync('example.md'), function (err, file) {
    if (err) throw err
    console.log(String(file))
  })
```

Now, running `node example` yields:

<!-- prettier-ignore -->
````markdown
# Title

`code`

`code  with a  few  spaces`

`    const param = [ 1,   2,  3 ]    `

`const param = false`

```
const block =  true
```

Paragraph with **bold** text.

Paragraph with **_bold italic_** text:

Paragraph with [link with spaces](https://link.com)

Paragraph with image ![caption with spaces](https://images.com/demo.png)

Paragraph with _italic_ text.
````

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