# remark-helpers

> Helper methods for remark

Latest version **0.0.6** (published 2017-06-16) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2017-06-16 |
| First published | 2016-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Aleksandr Filatov |
| Maintainers | greybax |
| Keywords | markdown, md, remark, mdast, helpers |

## Links

- npm: https://www.npmjs.com/package/remark-helpers
- Repository: https://github.com/greybax/remark-helpers
- Homepage: https://github.com/greybax/remark-helpers#readme
- Issues: https://github.com/greybax/remark-helpers/issues
- npm.io page: https://npm.io/package/remark-helpers

## Dependencies (3)

- [remark](https://npm.io/package/remark.md) ^7.0.1
- [remark-html](https://npm.io/package/remark-html.md) ^6.0.0
- [remove-markdown](https://npm.io/package/remove-markdown.md) ^0.1.0

## 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) — 2017-06-16
- 0.0.5 — 2017-02-16
- 0.0.4 — 2016-07-21
- 0.0.3 — 2016-07-20
- 0.0.2 — 2016-07-20
- 0.0.1 — 2016-07-19

## README

# remark-helpers

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Coveralls Status][coveralls-image]][coveralls-url]
[![Dependency Status][depstat-image]][depstat-url]
[![DevDependency Status][depstat-dev-image]][depstat-dev-url]

Basically, with `remark-helpers` you can find desire elements in markdown document
and process them in html or plaintext format.

Bunch of helpers for working with [remark][remark-readme].

Very important to notice, that this package is very simple and doesn’t contain
any smart and/or complicated logic, that’s why it’s tightly coupled with
[remark API for AST tree (MDAST)][remark-readme]. Check it out first.

[remark-readme]: https://github.com/wooorm/remark#readme

## Install

```
npm install --save remark-helpers
```

## Usage

```js
var md = require('remark-helpers');

md.ast('# title');          // mdast format see more https://github.com/wooorm/mdast
md.html(`*italic*`);        // <p><em>italic</em></p>
md.text('**`plaintext`**'); // plaintext
md.md(some_mdast_tree);     // markdown text
```

[Look into tests for more examples](tests).

[tests]: https://github.com/greybax/remark-helpers/blob/master/test.js
## API

### html(input)

Return html.

##### input

Type: `string` / `AST`

### text(input)

Return plain text.

##### input

Type: `string` / `AST`

### ast(input)

Return AST tree for current text.

##### input

Type: `string`

### md(input)

Return markdown for current input text.

##### input

Type:  `string` / `AST`


### Bunch of shortcut helpers. Based on [MDAST](https://github.com/wooorm/mdast)

```js
const isType = (node, type) => node.type === type;
const isDepth = (node, depth) => node.depth === depth;
const hasChildren = (node) => node.children ? true : false;

const isRoot = node => isType(node, "root");
const isParagraph = node => isType(node, "paragraph");
const isBlockquote = node => isType(node, 'blockquote');
const isHeading = node => isType(node, 'heading');
const isCode = node => isType(node, 'code');
const isInlineCode = node => isType(node, 'inlineCode');
const isYaml = node => isType(node, 'yaml');
const isHtml = node => isType(node, 'html');
const isList = node => isType(node, 'list');
const isListItem = node => isType(node, 'listItem');
const isTable = node => isType(node, 'table');
const isTableRow = node => isType(node, 'tableRow');
const isTableCell = node => isType(node, 'tableCell');
const isThematicBreak = node => isType(node, 'thematicBreak');
const isBreak = node => isType(node, 'break');
const isEmphasis = node => isType(node, 'emphasis');
const isStrong = node => isType(node, 'strong');
const isDelete = node => isType(node, 'delete');
const isLink = node => isType(node, 'link');
const isImage = node => isType(node, 'image');
const isFootnote = node => isType(node, 'footnote');
const isLinkReference = node => isType(node, 'linkReference');
const isImageReference = node => isType(node, 'imageReference');
const isFootnoteReference = node => isType(node, 'footnoteReference');
const isDefinition = node => isType(node, 'definition');
const isFootnoteDefinition = node => isType(node, 'footnoteDefinition');
const isText = node => isType(node, 'Text');
```

## License

MIT © [Aleksandr Filatov](https://alfilatov.com/)

[npm-url]: https://npmjs.org/package/remark-helpers
[npm-image]: https://img.shields.io/npm/v/remark-helpers.svg?style=flat-square

[travis-url]: https://travis-ci.org/greybax/remark-helpers
[travis-image]: https://img.shields.io/travis/greybax/remark-helpers.svg?style=flat-square

[coveralls-url]: https://coveralls.io/r/greybax/remark-helpers
[coveralls-image]: https://img.shields.io/coveralls/greybax/remark-helpers.svg?style=flat-square

[depstat-url]: https://david-dm.org/greybax/remark-helpers
[depstat-image]: https://david-dm.org/greybax/remark-helpers.svg?style=flat-square

[depstat-dev-url]: https://david-dm.org/greybax/remark-helpers
[depstat-dev-image]: https://david-dm.org/greybax/remark-helpers/dev-status.svg?style=flat-square

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