Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

mdast-util-to-string

Package Overview
Dependencies
0
Maintainers
2
Versions
14
Issues
File Explorer

Advanced tools

mdast-util-to-string

mdast utility to get the plain text content of a node

    3.1.0latest

Version published
Maintainers
2
Weekly downloads
7,053,949
decreased by-12.09%

Weekly downloads

Changelog

Source

  • bc43530 Add includeImageAlt option

Readme

Source

mdast-util-to-string

Build Coverage Downloads Size Sponsors Backers Chat

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

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install mdast-util-to-string

Use

import unified from 'unified' import remarkParse from 'remark-parse' import {toString} from 'mdast-util-to-string' var tree = unified() .use(remarkParse) .parse('Some _emphasis_, **importance**, and `code`.') console.log(toString(tree)) // => 'Some emphasis, importance, and code.'

API

This package exports the following identifiers: toString. There is no default export.

toString(node[, options])

Get the text content of a node or list of nodes.

The algorithm checks value of node and then alt. 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.

options.includeImageAlt

Whether to use alt (boolean, default: true)

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.

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

Keywords

FAQs

What is mdast-util-to-string?

mdast utility to get the plain text content of a node

Is mdast-util-to-string popular?

The npm package mdast-util-to-string receives a total of 6,749,770 weekly downloads. As such, mdast-util-to-string popularity was classified as popular.

Is mdast-util-to-string well maintained?

We found that mdast-util-to-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 2 open source maintainers collaborating on the project.

Last updated on 26 Apr 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc