https://github.com/reshape/retext
plugin that adds the ability to transform the contents of any element
https://github.com/reshape/retext
Last synced: about 1 year ago
JSON representation
plugin that adds the ability to transform the contents of any element
- Host: GitHub
- URL: https://github.com/reshape/retext
- Owner: reshape
- License: mit
- Created: 2016-08-09T16:39:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-02-05T12:42:36.000Z (over 7 years ago)
- Last Synced: 2025-03-24T05:26:58.660Z (about 1 year ago)
- Language: JavaScript
- Size: 304 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Reshape Retext
[](https://npmjs.com/package/reshape-retext)
[](https://travis-ci.org/reshape/retext?branch=master)
[](https://david-dm.org/reshape/retext)
[](https://coveralls.io/r/reshape/retext?branch=master)
Plugin wrapper over [Retext](https://github.com/wooorm/retext), an extensible system for analyzing and manipulating natural language.
## Usage
```js
const fs = require('fs')
const reshape = require('reshape')
const retext = require('reshape-retext')
const emoji = require('retext-emoji')
const smartypants = require('retext-smartypants')
reshape({
plugins: retext([[emoji, { convert: 'encode' }], smartypants])
}).process(fs.readFileSync('path/to/file.html', 'utf8'))
.then((result) => { fs.writeFileSync('path/to/file.html', 'utf8') })
```
#### Input html
```html
Hello "world"...
The three wise monkeys [. . .] sometimes called the three mystic
apes--are a pictorial maxim. Together they embody the proverbial
principle to ("see no evil, hear no evil, speak no evil"). The
three monkeys are Mizaru (:see_no_evil:), covering his eyes, who
sees no evil; Kikazaru (:hear_no_evil:), covering his ears, who
hears no evil; and Iwazaru (:speak_no_evil:), covering his mouth,
who speaks no evil.
```
#### Output html
```html
Hello “world”…
The three wise monkeys […] sometimes called the three mystic
apes—are a pictorial maxim. Together they embody the proverbial
principle to (“see no evil, hear no evil, speak no evil”). The
three monkeys are Mizaru (🙈), covering his eyes, who
sees no evil; Kikazaru (🙉), covering his ears, who
hears no evil; and Iwazaru (🙊), covering his mouth,
who speaks no evil.
```
## Skipping Tags
If you'd like to have retext skip processing any any particular tag, you can add a `retext-skip` attribute to the tag. The plugin will not process the tag's contents, but will remove the attribute in the output. For example, the following input:
```html
:tada:
:tada:
```
...would produce this output:
```html
🎉
:tada:
```
## License & Contributing
- Licensed under [MIT](LICENSE.md)
- See our [contributing guide](contributing.md)