{"id":13784032,"url":"https://github.com/retextjs/retext-readability","last_synced_at":"2025-04-09T18:22:13.678Z","repository":{"id":40005284,"uuid":"49443610","full_name":"retextjs/retext-readability","owner":"retextjs","description":"plugin to check readability","archived":false,"fork":false,"pushed_at":"2023-09-11T09:41:17.000Z","size":143,"stargazers_count":89,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-26T01:04:03.515Z","etag":null,"topics":["automated-readability","coleman-liau","dale-chall","gunning-fog","readability","retext","retext-plugin","smog","spache"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/retextjs.png","metadata":{"funding":{"github":"unifiedjs","open_collective":"unified"},"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-01-11T17:53:22.000Z","updated_at":"2024-04-21T03:09:30.000Z","dependencies_parsed_at":"2024-01-18T18:09:48.315Z","dependency_job_id":"faa86a21-c29f-4cfe-8e4f-304190b7461c","html_url":"https://github.com/retextjs/retext-readability","commit_stats":{"total_commits":115,"total_committers":7,"mean_commits":"16.428571428571427","dds":0.06956521739130439,"last_synced_commit":"fc84a20faf4e85efa471a788942d3c9195956e82"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-readability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-readability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-readability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-readability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retextjs","download_url":"https://codeload.github.com/retextjs/retext-readability/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085683,"owners_count":21045195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated-readability","coleman-liau","dale-chall","gunning-fog","readability","retext","retext-plugin","smog","spache"],"created_at":"2024-08-03T19:00:34.621Z","updated_at":"2025-04-09T18:22:13.653Z","avatar_url":"https://github.com/retextjs.png","language":"JavaScript","readme":"# retext-readability\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[retext][]** plugin to check readability.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`unified().use(retextReadability[, options])`](#unifieduseretextreadability-options)\n    *   [`Options`](#options)\n*   [Messages](#messages)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([retext][]) plugin to check readability: whether\nyour presumed target audience can read your prose.\nIt applies [Dale—Chall][dale-chall],\n[Automated Readability][automated-readability], [Coleman-Liau][], [Flesch][],\n[Gunning-Fog][], [SMOG][], and [Spache][].\n\n## When should I use this?\n\nYou can use this plugin when you’re dealing with content that might be\ndifficult to read to some folks, and have authors that can fix that content.\n\n\u003e 💡 **Tip**: I also made an online, editable, demo, similar to this project:\n\u003e [`wooorm.com/readability`](https://wooorm.com/readability/).\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install retext-readability\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport retextReadability from 'https://esm.sh/retext-readability@8'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import retextReadability from 'https://esm.sh/retext-readability@8?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay our document `example.txt` contains:\n\n```txt\nThe cat sat on the mat\n\nThe constellation also contains an isolated neutron\nstar—Calvera—and H1504+65, the hottest white dwarf yet\ndiscovered, with a surface temperature of 200,000 kelvin\n```\n\n…and our module `example.js` contains:\n\n```js\nimport retextEnglish from 'retext-english'\nimport retextReadability from 'retext-readability'\nimport retextStringify from 'retext-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await unified()\n  .use(retextEnglish)\n  .use(retextReadability)\n  .use(retextStringify)\n  .process(await read('example.txt'))\n\nconsole.error(reporter(file))\n```\n\n…then running `node example.js` yields:\n\n```txt\nexample.txt\n3:1-5:57 warning Unexpected hard to read sentence, according to 4 out of 7 algorithms readability retext-readability\n\n⚠ 1 warning\n```\n\nThe default target age is `16`.\nYou can pass something else, such as `6`:\n\n```diff\n   .use(retextEnglish)\n-  .use(retextReadability)\n+  .use(retextReadability, {age: 6})\n   .use(retextStringify)\n```\n\n…then running `node example.js` again yields:\n\n```txt\nexample.txt\n1:1-1:23 warning Unexpected hard to read sentence, according to 4 out of 7 algorithms readability retext-readability\n3:1-5:57 warning Unexpected hard to read sentence, according to all 7 algorithms      readability retext-readability\n\n⚠ 2 warnings\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`retextReadability`][api-retext-readability].\n\n### `unified().use(retextReadability[, options])`\n\nCheck hard to read sentences.\n\n###### Parameters\n\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `age` (`number`, default: `16`)\n    — target age group\n*   `minWords` (`number`, default: `5`)\n    — check sentences with at least this number of words;\n    most algos are made to detect the reading level on an entire text;\n    this plugin checks each sentence on its own;\n    for short sentences, one long or complex word can strongly skew the\n    results\n*   `threshold` (`number`, default: `4 / 7`)\n    — number of algos (out of 7) that need to agree something is hard to read\n\n## Messages\n\nEach message is emitted as a [`VFileMessage`][vfile-message], with `source` set\nto `'retext-readability'`, `ruleId` to `'readability'`, `actual` to the\ndifficult sentence, and `expected` to an empty array.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `retext-readability@^8`,\ncompatible with Node.js 16.\n\n## Related\n\n*   [`retext-syntax-mentions`](https://github.com/retextjs/retext-syntax-mentions)\n    — classify [**@mentions**](https://github.com/blog/821) as syntax\n*   [`retext-syntax-urls`](https://github.com/retextjs/retext-syntax-urls)\n    — classify URLs and filepaths as syntax\n*   [`retext-simplify`](https://github.com/retextjs/retext-simplify)\n    — check phrases for simpler alternatives\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`retextjs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/retextjs/retext-readability/workflows/main/badge.svg\n\n[build]: https://github.com/retextjs/retext-readability/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/retextjs/retext-readability.svg\n\n[coverage]: https://codecov.io/github/retextjs/retext-readability\n\n[downloads-badge]: https://img.shields.io/npm/dm/retext-readability.svg\n\n[downloads]: https://www.npmjs.com/package/retext-readability\n\n[size-badge]: https://img.shields.io/bundlejs/size/retext-readability\n\n[size]: https://bundlejs.com/?q=retext-readability\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/retextjs/retext/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[health]: https://github.com/retextjs/.github\n\n[contributing]: https://github.com/retextjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/retextjs/.github/blob/main/support.md\n\n[coc]: https://github.com/retextjs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[automated-readability]: https://github.com/words/automated-readability\n\n[coleman-liau]: https://github.com/words/coleman-liau\n\n[dale-chall]: https://github.com/words/dale-chall-formula\n\n[flesch]: https://github.com/words/flesch\n\n[gunning-fog]: https://github.com/words/gunning-fog\n\n[retext]: https://github.com/retextjs/retext\n\n[smog]: https://github.com/words/smog-formula\n\n[spache]: https://github.com/words/spache-formula\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[vfile-message]: https://github.com/vfile/vfile-message\n\n[api-options]: #options\n\n[api-retext-readability]: #unifieduseretextreadability-options\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext-readability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretextjs%2Fretext-readability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext-readability/lists"}