JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15414640
  • Score
    100M100P100Q244176F
  • License MIT

Utility to get the plain text content of a node

Package Exports

  • mdast-util-to-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-util-to-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mdast-util-to-string Build Status Coverage Status

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

Installation

npm:

npm install mdast-util-to-string

mdast-util-to-string is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

/*
 * Dependencies.
 */

var mdast = require('mdast');
var toString = require('mdast-util-to-string');

/*
 * AST.
 */

var ast = mdast.parse('Some *emphasis*, **strongness**, and `code`.');

toString(ast);
// 'Some emphasis, strongness, and code.'

API

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).

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

Parameters:

Returns: string — text representation of node.

License

MIT © Titus Wormer