Skip to content

Commit

Permalink
feat(retext): Add retext support
Browse files Browse the repository at this point in the history
All reporting via retext
  • Loading branch information
NickColley committed Oct 28, 2022
1 parent 307b850 commit c4daf78
Show file tree
Hide file tree
Showing 11 changed files with 5,513 additions and 97 deletions.
64 changes: 61 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

Use the [unified](https://unifiedjs.com/) ecosystem in Eleventy.

You can render and transform:
You can render, transform and lint:

- markdown with the [remark](https://github.com/remarkjs/remark) ecosystem.
- html with the [rehype](https://github.com/rehypejs/rehype) ecosystem.

[retext](https://github.com/retextjs/retext) is not yet supported, raise an issue if you'd like this.
- text with the [retext](https://github.com/retextjs/retext) ecosystem.

## Install

Expand Down Expand Up @@ -105,6 +104,65 @@ module.exports = function (eleventyConfig) {
};
```
### Configuring text transforms (retext plugins)
```bash
npm install eleventy-plugin-unified retext-repeated-words vfile-reporter
```
```javascript
// .eleventy.config.cjs
const EleventyUnifiedPlugin = require("eleventy-plugin-unified");

module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyUnifiedPlugin, [
reporter: 'vfile-reporter',
textTransforms: [
'retext-repeated-words'
]
]);
};
```
or
```javascript
// .eleventy.config.cjs
const EleventyUnifiedPlugin = require("eleventy-plugin-unified");

module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyUnifiedPlugin, [
reporter: (file) => {
console.log(file);
},
textTransforms: [
'retext-repeated-words'
]
]);
};
```
### Configuring text parser language
```bash
npm install eleventy-plugin-unified retext-latin retext-repeated-words vfile-reporter
```
```javascript
// .eleventy.config.cjs
const EleventyUnifiedPlugin = require("eleventy-plugin-unified");

module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyUnifiedPlugin, [
textParser: 'retext-latin',
reporter: 'vfile-reporter',
textTransforms: [
'retext-repeated-words'
]
]);
};
```
### Configuring options for a plugin
```javascript
Expand Down
Loading

0 comments on commit c4daf78

Please sign in to comment.