Socket
Book a DemoInstallSign in
Socket

mdast-util-to-string

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-to-string

Utility to get the plain text content of a node

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
11M
-4.39%
Maintainers
1
Weekly downloads
 
Created
Source

mdast-util-to-string Build Status Coverage Status

remark utility to get the plain text content of an mdast node.

Installation

npm:

npm install mdast-util-to-string

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

Usage

/*
 * Dependencies.
 */

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

/*
 * AST.
 */

var ast = remark.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 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 for that.

Parameters:

  • node (Node).

Returns: string — text representation of node.

License

MIT © Titus Wormer

Keywords

mdast

FAQs

Package last updated on 17 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts