mdast-util-to-string
mdast utility to get the plain text content of a node
Last updated 7 months ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mdast-util-to-string 
SYNC missed versions from official npm registry.

mdast-util-to-string

Build Coverage Downloads Size Sponsors Backers Chat

mdast utility to get the plain text content of a node.

Install

npm:

npm install mdast-util-to-string

Use

var unified = require('unified')
var parse = require('remark-parse')
var toString = require('mdast-util-to-string')

var tree = unified()
  .use(parse)
  .parse('Some _emphasis_, **importance**, and `code`.')

console.log(toString(tree)) // => 'Some emphasis, importance, and code.'

API

toString(node)

Get the text content of a node.

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). If the given node is in fact a list of nodes, serializes them.

This is not a markdown to plain-text library. Use strip-markdown for that.

Security

Use of mdast-util-to-string does not involve hast, user content, or change the tree, so there are no openings for cross-site scripting (XSS) attacks.

Related

Contribute

See contributing.md in syntax-tree/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Current Tags

  • 1.1.0                                ...           latest (7 months ago)

11 Versions

  • 1.1.0                                ...           7 months ago
  • 1.0.8                                ...           7 months ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (2)
Downloads
Today 103
This Week 467
This Month 9,347
Last Day 364
Last Week 2,427
Last Month 11,591
Dependencies (0)
None
Dev Dependencies (8)
Dependents (197)

Copyright 2014 - 2016 © taobao.org |