What is retext-stringify?
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.
What are retext-stringify's main functionalities?
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));
});
Other packages similar to retext-stringify
remark-stringify
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
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
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-stringify

retext plugin to stringify natural language.
Compiler for unified.
Stringifies nlcst syntax trees.
Read more about the unified collective on Medium »
Install
npm:
npm install retext-stringify
Use
var unified = require('unified')
var stream = require('unified-stream')
var english = require('retext-english')
var stringify = require('retext-stringify')
var emoji = require('retext-emoji')
var processor = unified()
.use(english)
.use(emoji, {convert: 'encode'})
.use(stringify)
process.stdin.pipe(stream(processor)).pipe(process.stdout)
API
processor.use(stringify)
Compile nlcst syntax trees.
There is no configuration for the compiler.
Contribute
See contributing.md
in retextjs/.github
for ways
to get started.
See support.md
for ways to get help.
Ideas for new plugins and tools can be posted in retextjs/ideas
.
A curated list of awesome retext resources can be found in awesome
retext.
This project has a Code of Conduct.
By interacting with this repository, organisation, or community you agree to
abide by its terms.
License
MIT © Titus Wormer