Skip to content

Commit

Permalink
Refactor readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 17, 2016
1 parent f86478e commit 22f132a
Showing 1 changed file with 41 additions and 16 deletions.
57 changes: 41 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# mdast-util-to-string [![Build Status](https://img.shields.io/travis/wooorm/mdast-mdast-util-to-string.svg)](https://travis-ci.org/wooorm/mdast-mdast-util-to-string) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/mdast-mdast-util-to-string.svg)](https://codecov.io/github/wooorm/mdast-mdast-util-to-string)
# mdast-util-to-string [![Build Status][travis-badge]][travis] [![Coverage Status][coverage-badge]][coverage]

[**remark**](https://github.com/wooorm/remark) utility to get the plain text
content of an [**mdast**](https://github.com/wooorm/mdast) node.
[**remark**][remark] utility to get the plain text
content of an [**mdast**][mdast] node.

## Installation

[npm](https://docs.npmjs.com/cli/install):
[npm][npm-install]:

```bash
npm install mdast-util-to-string
```

**mdast-util-to-string** is also available for
[duo](http://duojs.org/#getting-started), and as an AMD, CommonJS, and globals
module, [uncompressed and
compressed](https://github.com/wooorm/mdast-util-to-string/releases).
**mdast-util-to-string** is also available for [duo][],
and as an AMD, CommonJS, and globals module,
[uncompressed and compressed][releases].

## Usage

Expand All @@ -38,23 +37,49 @@ toString(ast);

## API

### toString(node)
### `toString(node)`

Get the text content of a node.

The algorithm checks the value of `node`, then its `alt`, and then
its `title`, in that order. If no value is found, the algorithm checks
the children of `node` and joins them (without spaces or newlines).
The algorithm checks `value` of `node`, then `alt`, and finally `title`.
If no value is found, the algorithm checks the children of `node` and
joins them (without spaces or newlines).

> This is not a markdown to plain-text library.
> Use [strip-markdown](https://github.com/wooorm/strip-markdown) for that.
Parameters:
**Parameters**:

* `node` (`Node`) — [**mdast** node](https://github.com/wooorm/mdast#node);
* `node` ([`Node`][mdast-node]).

Returns: `string` — text representation of `node`.
**Returns**: `string` — text representation of `node`.

## License

[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
[MIT][license] © [Titus Wormer][home]

<!-- Definitions -->

[travis-badge]: https://img.shields.io/travis/wooorm/mdast-util-to-string.svg

[travis]: https://travis-ci.org/wooorm/mdast-util-to-string

[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/mdast-util-to-string.svg

[coverage]: https://codecov.io/github/wooorm/mdast-util-to-string

[remark]: https://github.com/wooorm/remark

[mdast]: https://github.com/wooorm/mdast

[mdast-node]: https://github.com/wooorm/mdast#node

[npm-install]: https://docs.npmjs.com/cli/install

[duo]: http://duojs.org/#getting-started

[releases]: https://github.com/wooorm/mdast-util-to-string/releases

[license]: LICENSE

[home]: http://wooorm.com

0 comments on commit 22f132a

Please sign in to comment.