Gathering detailed insights and metrics for mdast-util-to-string
Gathering detailed insights and metrics for mdast-util-to-string
Gathering detailed insights and metrics for mdast-util-to-string
Gathering detailed insights and metrics for mdast-util-to-string
utility to get the plain text content of an mdast node
npm install mdast-util-to-string
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
39 Stars
133 Commits
9 Forks
10 Watching
1 Branches
12 Contributors
Updated on 08 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-1.7%
2,517,128
Compared to previous day
Last week
4%
13,252,124
Compared to previous week
Last month
13.5%
55,134,764
Compared to previous month
Last year
29.4%
624,183,875
Compared to previous year
1
mdast utility to get the text content of a node.
This package is a tiny utility that gets the textual content of a node.
This utility is useful when you have a node, say a heading, and want to get the text inside it.
This package does not serialize markdown, that’s what
mdast-util-to-markdown
does.
Similar packages, hast-util-to-string
and
hast-util-to-text
, do the same but on hast.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install mdast-util-to-string
In Deno with esm.sh
:
1import {toString} from 'https://esm.sh/mdast-util-to-string@4'
In browsers with esm.sh
:
1<script type="module"> 2 import {toString} from 'https://esm.sh/mdast-util-to-string@4?bundle' 3</script>
1import {fromMarkdown} from 'mdast-util-from-markdown' 2import {toString} from 'mdast-util-to-string' 3 4const tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.') 5 6console.log(toString(tree)) // => 'Some emphasis, importance, and code.'
This package exports the identifier toString
.
There is no default export.
toString(value[, options])
Get the text content of a node or list of nodes.
Prefers the node’s plain-text fields, otherwise serializes its children, and if the given value is an array, serialize the nodes in it.
Serialized value
(string
).
Options
Configuration (TypeScript type).
includeImageAlt
(boolean
, default: true
)
— whether to use alt
for image
sincludeHtml
(boolean
, default: true
)
— whether to use value
of HTMLThis package is fully typed with TypeScript.
It exports the additional type Options
.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, mdast-util-to-string@^4
,
compatible with Node.js 16.
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.
hast-util-to-string
— get text content in hasthast-util-to-text
— get text content in hast according to the innerText
algorithmSee 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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More