{"id":13451859,"url":"https://github.com/retextjs/retext","last_synced_at":"2025-12-12T03:23:25.249Z","repository":{"id":17657063,"uuid":"20461647","full_name":"retextjs/retext","owner":"retextjs","description":"natural language processor powered by plugins part of the @unifiedjs collective","archived":false,"fork":false,"pushed_at":"2025-02-04T14:37:32.000Z","size":768,"stargazers_count":2398,"open_issues_count":0,"forks_count":93,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-05-08T02:00:01.713Z","etag":null,"topics":["ast","cst","javascript","natural-language","retext","unified"],"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":{"files":{"readme":"readme.md","changelog":"changelog.md","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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2014-06-03T22:13:11.000Z","updated_at":"2025-05-05T04:29:35.000Z","dependencies_parsed_at":"2023-12-24T00:28:48.591Z","dependency_job_id":"9f658553-ae39-4836-b3a3-7cb5c2bcebbc","html_url":"https://github.com/retextjs/retext","commit_stats":{"total_commits":540,"total_committers":13,"mean_commits":41.53846153846154,"dds":"0.029629629629629672","last_synced_commit":"3acbf0214b24618d863ab165a7be7694d3136b17"},"previous_names":["wooorm/retext"],"tags_count":71,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retextjs","download_url":"https://codeload.github.com/retextjs/retext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252983760,"owners_count":21835764,"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":["ast","cst","javascript","natural-language","retext","unified"],"created_at":"2024-07-31T07:01:04.979Z","updated_at":"2025-12-12T03:23:25.201Z","avatar_url":"https://github.com/retextjs.png","language":"JavaScript","readme":"# [![retext][logo]][unified]\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** is a tool that transforms natural language with plugins.\nThese plugins can inspect and change the natural language.\nYou can use retext on the server, the client, deno, etc.\n\n## Intro\n\nretext is an ecosystem of plugins that work with natural language as structured\ndata, specifically CSTs (concrete syntax trees).\nSyntax trees make it easy for programs to deal with prose.\nWe call those programs plugins.\nPlugins inspect and change trees.\nYou can use the many existing plugins or you can make your own.\nSome example use cases are to [check spelling][retext-spell],\n[fix typography][retext-smartypants], or\n[make sure text is readable][retext-readability].\n\n* for more about us, see [`unifiedjs.com`][site]\n* for questions, see [support][]\n* to help, see [contribute][] or [sponsor][] below\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Plugins](#plugins)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Contribute](#contribute)\n* [Sponsor](#sponsor)\n* [License](#license)\n\n## What is this?\n\nWith this project and a plugin, you can turn simple punctuation:\n\n```text\nHe said, \"A 'simple' english sentence. . .\n```\n\n…into smart punctuation:\n\n```text\nHe said, “A ‘simple’ english sentence…”\n```\n\n\u003cdetails\u003e\u003csummary\u003eShow example code\u003c/summary\u003e\n\n```js\nimport retextLatin from 'retext-latin'\nimport retextSmartyPants from 'retext-smartypants'\nimport retextStringify from 'retext-stringify'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(retextLatin)\n  .use(retextSmartyPants)\n  .use(retextStringify)\n  .process(\"He said, \\\"A 'simple' english sentence. . .\")\n\nconsole.log(String(file))\n```\n\n\u003c/details\u003e\n\nWith another plugin, you can check natural language:\n\n**In**:\n\n```text\nWhere can I find an ATM machine?\n```\n\n**Out**:\n\n```text\n1:21-1:32 warning Unexpected redundant `ATM machine`, expected `ATM` atm retext-redundant-acronyms\n\n⚠ 1 warning\n```\n\n\u003cdetails\u003e\u003csummary\u003eShow example code\u003c/summary\u003e\n\n```js\nimport retextEnglish from 'retext-english'\nimport retextRedundantAcronyms from 'retext-redundant-acronyms'\nimport retextStringify from 'retext-stringify'\nimport {unified} from 'unified'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await unified()\n  .use(retextEnglish)\n  .use(retextRedundantAcronyms)\n  .use(retextStringify)\n  .process('Where can I find an ATM machine?')\n\nconsole.log(reporter(file))\n```\n\n\u003c/details\u003e\n\n…and you can make your own plugins.\n\nYou can use retext for many different things.\n**[unified][]** is the core project that transforms content with ASTs.\n**retext** adds support for natural language to unified.\n**[nlcst][]** is the natural language AST that retext uses.\n\nThis GitHub repository is a monorepo that contains the following packages:\n\n* [`retext-dutch`][retext-dutch]\n  — parse Dutch prose to a syntax tree\n* [`retext-english`][retext-english]\n  — parse English prose to a syntax tree\n* [`retext-latin`][retext-latin]\n  — parse any Latin-script prose to a syntax tree\n* [`retext-stringify`][retext-stringify]\n  — serialize a syntax tree\n* [`retext`][api]\n  — programmatic interface with both `retext-latin` and `retext-stringify`\n\n## When should I use this?\n\nIt is recommended to use `unified` with `retext-english` (or `retext-dutch`)\nand `retext-stringify` if your content is in English (or Dutch).\nOtherwise, if your content is in another Latin-script language, use `retext`.\n\n## Plugins\n\nretext plugins deal with natural language.\nYou can choose from the many plugins that already exist.\nHere are three good ways to find plugins:\n\n* [`awesome-retext`][awesome-retext]\n  — selection of the most awesome projects\n* [List of plugins][list-of-plugins]\n  — list of all plugins\n* [`retext-plugin` topic][topic]\n  — any tagged repo on GitHub\n\nSome plugins are maintained by us here in the `@retextjs` organization while\nothers are maintained by folks elsewhere.\nAnyone can make retext plugins, so as always when choosing whether to include\ndependencies in your project, make sure to carefully assess the quality of\nretext plugins too.\n\n## Types\n\nThe retext organization and the unified collective as a whole is fully typed\nwith [TypeScript][].\nTypes for nlcst are available in [`@types/nlcst`][types-nlcst].\n\nFor TypeScript to work, it is important to type your plugins.\nFor example:\n\n```js\n/**\n * @import {Root} from 'nlcst'\n */\n\n/**\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [someField]\n *   Some option.\n */\n\n/**\n * My plugin.\n *\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns\n *   Transform.\n */\nexport function myRetextPluginAcceptingOptions(options) {\n  /**\n   * @param {Root} tree\n   *   Tree.\n   * @param {VFile} file\n   *   File.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree, file) {\n    // Do things.\n  }\n}\n```\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 compatible with Node.js 16.\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\nFor info on how to submit a security report, see our\n[security policy][security].\n\n## Sponsor\n\nSupport this effort and give back by sponsoring on [OpenCollective][collective]!\n\n\u003ctable\u003e\n\u003ctr valign=\"middle\"\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://vercel.com\"\u003eVercel\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://vercel.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/14985020?s=256\u0026v=4\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://motif.land\"\u003eMotif\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://motif.land\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/74457950?s=256\u0026v=4\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://www.hashicorp.com\"\u003eHashiCorp\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.hashicorp.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/761456?s=256\u0026v=4\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://www.gitbook.com\"\u003eGitBook\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.gitbook.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/7111340?s=256\u0026v=4\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://www.gatsbyjs.org\"\u003eGatsby\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.gatsbyjs.org\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/12551863?s=256\u0026v=4\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr valign=\"middle\"\u003e\n\u003c/tr\u003e\n\u003ctr valign=\"middle\"\u003e\n\u003ctd width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\"\u003e\n  \u003ca href=\"https://www.netlify.com\"\u003eNetlify\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003c!--OC has a sharper image--\u003e\n  \u003ca href=\"https://www.netlify.com\"\u003e\u003cimg src=\"https://images.opencollective.com/netlify/4087de2/logo/256.png\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://www.coinbase.com\"\u003eCoinbase\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.coinbase.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/1885080?s=256\u0026v=4\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://themeisle.com\"\u003eThemeIsle\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://themeisle.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/58979018?s=128\u0026v=4\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://expo.io\"\u003eExpo\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://expo.io\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/12504344?s=128\u0026v=4\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://boostnote.io\"\u003eBoost Note\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://boostnote.io\"\u003e\u003cimg src=\"https://images.opencollective.com/boosthub/6318083/logo/128.png\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://markdown.space\"\u003eMarkdown Space\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://markdown.space\"\u003e\u003cimg src=\"https://images.opencollective.com/markdown-space/e1038ed/logo/128.png\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\" align=\"center\"\u003e\n  \u003ca href=\"https://www.holloway.com\"\u003eHolloway\u003c/a\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.holloway.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/35904294?s=128\u0026v=4\" width=\"64\"\u003e\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd width=\"10%\"\u003e\u003c/td\u003e\n\u003ctd width=\"10%\"\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr valign=\"middle\"\u003e\n\u003ctd width=\"100%\" align=\"center\" colspan=\"8\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://opencollective.com/unified\"\u003e\u003cstrong\u003eYou?\u003c/strong\u003e\u003c/a\u003e\n  \u003cbr\u003e\u003cbr\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[logo]: https://raw.githubusercontent.com/retextjs/retext/3420f05/logo.svg?sanitize=true\n\n[build-badge]: https://github.com/retextjs/retext/workflows/main/badge.svg\n\n[build]: https://github.com/retextjs/retext/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/retextjs/retext.svg\n\n[coverage]: https://codecov.io/github/retextjs/retext\n\n[downloads-badge]: https://img.shields.io/npm/dm/retext.svg\n\n[downloads]: https://www.npmjs.com/package/retext\n\n[size-badge]: https://img.shields.io/bundlejs/size/retext\n\n[size]: https://bundlejs.com/?q=retext\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]: https://github.com/retextjs/retext/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[health]: https://github.com/retextjs/.github\n\n[security]: https://github.com/retextjs/.github/blob/main/security.md\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[unified]: https://github.com/unifiedjs/unified\n\n[types-nlcst]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/nlcst\n\n[typescript]: https://www.typescriptlang.org\n\n[site]: https://unifiedjs.com\n\n[topic]: https://github.com/topics/retext-plugin\n\n[nlcst]: https://github.com/syntax-tree/nlcst\n\n[awesome-retext]: https://github.com/retextjs/awesome-retext\n\n[retext-english]: https://github.com/retextjs/retext/tree/main/packages/retext-english\n\n[retext-dutch]: https://github.com/retextjs/retext/tree/main/packages/retext-dutch\n\n[retext-latin]: https://github.com/retextjs/retext/tree/main/packages/retext-latin\n\n[retext-stringify]: https://github.com/retextjs/retext/tree/main/packages/retext-stringify\n\n[api]: https://github.com/retextjs/retext/tree/main/packages/retext\n\n[list-of-plugins]: https://github.com/retextjs/retext/tree/main/doc/plugins.md\n\n[retext-readability]: https://github.com/retextjs/retext-readability\n\n[retext-smartypants]: https://github.com/retextjs/retext-smartypants\n\n[retext-spell]: https://github.com/retextjs/retext-spell\n\n[contribute]: #contribute\n\n[sponsor]: #sponsor\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["Packages","包","JavaScript","Syntaxes","javascript","Javascript","Official","函式庫"],"sub_categories":["Natural language processing","自然语言处理","Tools","[Tools](#tools-1)","書籍"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretextjs%2Fretext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext/lists"}