Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
retext-stringify
Advanced tools
The retext-stringify package is a plugin for the retext ecosystem that serializes a syntax tree into a string. It is typically used in conjunction with other retext plugins to process natural language text and then convert the processed syntax tree back into a string format.
Basic Stringify
This code demonstrates the basic usage of retext-stringify. It processes a simple English sentence and converts the resulting syntax tree back into a string.
const retext = require('retext');
const stringify = require('retext-stringify');
const english = require('retext-english');
const report = require('vfile-reporter');
retext()
.use(english)
.use(stringify)
.process('This is a simple example.', function (err, file) {
if (err) throw err;
console.log(String(file));
console.error(report(file));
});
remark-stringify is a plugin for the remark ecosystem that serializes Markdown syntax trees into Markdown strings. It is similar to retext-stringify but is specifically designed for Markdown content.
rehype-stringify is a plugin for the rehype ecosystem that serializes HTML syntax trees into HTML strings. It is similar to retext-stringify but is specifically designed for HTML content.
mdast-util-to-string is a utility that converts an MDAST (Markdown Abstract Syntax Tree) node to a string. It is similar to retext-stringify but is focused on converting specific nodes rather than entire trees.
retext plugin to add support for serializing natural language.
This package is a unified (retext) plugin that defines how to take a syntax tree as input and turn it into serialized natural language. When it’s used, natural language is serialized as the final result.
See the monorepo readme for info on what the retext ecosystem is.
This plugin adds support to unified for serializing natural language.
You can alternatively use retext
instead, which combines
unified, retext-latin
, and this plugin.
This package is ESM only. In Node.js (version 16+), install with npm:
npm install retext-stringify
In Deno with esm.sh
:
import retextStringify from 'https://esm.sh/retext-stringify@4'
In browsers with esm.sh
:
<script type="module">
import retextStringify from 'https://esm.sh/retext-stringify@4?bundle'
</script>
import retextEmoji from 'retext-emoji'
import retextLatin from 'retext-latin'
import retextProfanities from 'retext-profanities'
import retextStringify from 'retext-stringify'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'
const file = await unified()
.use(retextLatin)
.use(retextProfanities)
.use(retextEmoji, {convert: 'encode'})
.use(retextStringify)
.process('He’s set on beating your butt for sheriff! :cop:')
console.log(String(file))
console.error(reporter(file))
Yields:
He’s set on beating your butt for sheriff! 👮
1:26-1:30 warning Be careful with `butt`, it’s profane in some cases butt retext-profanities
⚠ 1 warning
This package exports no identifiers.
The default export is retextStringify
.
unified().use(retextStringify)
Add support for serializing natural language.
There are no parameters.
Nothing (undefined
).
The syntax tree used in retext is nlcst.
This package is fully typed with TypeScript. It exports no additional types.
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, retext-stringify@^4
,
compatible with Node.js 16.
See contributing.md
in retextjs/.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.
Support this effort and give back by sponsoring on OpenCollective!
Vercel |
Motif |
HashiCorp |
GitBook |
Gatsby | ||||
Netlify |
Coinbase |
ThemeIsle |
Expo |
Boost Note |
Markdown Space |
Holloway | ||
You? |
FAQs
retext plugin to serialize prose
The npm package retext-stringify receives a total of 271,426 weekly downloads. As such, retext-stringify popularity was classified as popular.
We found that retext-stringify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.