Skip to content

syntax-tree/mdast-util-to-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdast-util-to-string Build Status Coverage Status Chat

Get the plain text content of an MDAST node.

Installation

npm:

npm install mdast-util-to-string

Usage

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

var tree = remark().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).

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

License

MIT © Titus Wormer

About

utility to get the plain text content of an mdast node

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •