{"name":"rehype-retext","version":"2.0.4","keywords":["unified","rehype","rehype-plugin","retext","retext-plugin","html","natural","langauge","hast","nlcst"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"rehype-retext@2.0.4","maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/rehypejs/rehype-retext#readme","bugs":{"url":"https://github.com/rehypejs/rehype-retext/issues"},"xo":{"esnext":false,"ignores":["rehype-retext.js"],"prettier":true},"nyc":{"lines":100,"branches":100,"functions":100,"check-coverage":true},"dist":{"shasum":"63badf6ce7bf1f39d50c4d895569965c497ffe09","tarball":"http://registry-npm.ywwl.com/rehype-retext/download/rehype-retext-2.0.4.tgz","fileCount":4,"integrity":"sha512-OnGX5RE8WyEs/Snz+Bs8DM9uGdrNUXMhCC7CW3S1cIZVOC90VdewdE+71kpG6LOzS0xwgZyItwrhjGv+oQgwkQ==","signatures":[{"sig":"MEYCIQC9kO+/kAlGt9ksAaQSS1nlsRxPt/scaV7bxd6v19jwfAIhAJHAXyCN9vlWS6Nfkt34PGpqnufs5eLkt5jjhPb37pQJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9734,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJebh1ECRA9TVsSAnZWagAAY3sP/18JdnNG4Ld+m5UsPMik\nEskBw0qWlRIZsII093rI03rOZkpTEUxqNjNTAX0kXQByeLvxrqY8y9cYjOQN\n4qpRnKlYO9RiVN4sjr7kknREyk1ixToJu8eTQxquAFToJ1JjHLiSZdm+RkYn\nGO7uLYSyJgLyIcR3+nceMhn2ksaPUkhWEaC2SttyljRgNHF+ddXwrQN+Q8Ey\ntK3IK5wZjr21ne6qoxRSPYeLN0n5PwUjvdyMgErUa9ztqdXNxTS8Hq1WtUcX\n5y2R4RN4+A41BDW10+NiQFFE4LGbK0HT1r1sl/nBLuq53ShCnkdYwDhUHhmG\nI9mDGgU5OyV4H8f7Qdq4k71vH9MrpYkFJMNVPz5EivznNgC+X8gS22ys5fqI\nmlDneW8O0Av1kiwb7f2t0/kS2RQZYD7np7rhYtoELiN/4+E4P/6KJdK/I0wU\nb4SEK/xBwOMIZ4QFd6lr/u04Spb6ri8bfENmgiErLsl4IwXPFT+KFkziqk3L\nDIEN0HNwH/vRETWvtYekw91956118dRy/QTdFpBLqhT/LXpbYYG3Lt+yLZUE\n1iYOtJijGdY++VpKWD4KH1iR3CnCK3GMXH3nZo2GP0zHYKSCqecO/5deNwuU\nt/4OwNHwB+MrgmG2McB57RP+r9o+PHGz1wwWzU5Prqf3v39wrtTcYqTnqh3l\nqv4T\r\n=J9XZ\r\n-----END PGP SIGNATURE-----\r\n","size":3799,"noattachment":false,"key":"/rehype-retext/-/rehype-retext-2.0.4.tgz"},"funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"c681207c129879f850b5e56c2af47aef8821d30e","scripts":{"test":"npm run format && npm run build && npm run test-coverage","build":"npm run build-bundle && npm run build-mangle","format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","test-api":"node test","build-bundle":"browserify index.js -s rehypeRetext > rehype-retext.js","build-mangle":"browserify index.js -s rehypeRetext -p tinyify > rehype-retext.min.js","test-coverage":"nyc --reporter lcov tape test.js"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/rehypejs/rehype-retext.git","type":"git"},"_npmVersion":"6.14.2","description":"rehype plugin to transform to retext","directories":{},"_nodeVersion":"13.10.1","dependencies":{"hast-util-to-nlcst":"^1.0.0"},"remarkConfig":{"plugins":["preset-wooorm"]},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.28.0","nyc":"^15.0.0","tape":"^4.0.0","tinyify":"^2.0.0","unified":"^8.0.0","prettier":"^1.0.0","browserify":"^16.0.0","remark-cli":"^7.0.0","rehype-parse":"^6.0.0","retext-english":"^3.0.0","rehype-stringify":"^6.0.0","retext-stringify":"^2.0.0","remark-preset-wooorm":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-retext_2.0.4_1584274756373_0.1408091234547122","host":"s3://npm-registry-packages"},"readme":"# rehype-retext\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**[rehype][]** plugin to support **[retext][]**.\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(rehypeRetext, options)`](#unifieduserehyperetext-options)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([rehype][]) plugin to support [retext][].\n\n**unified** is a project that transforms content with abstract syntax trees\n(ASTs).\n**rehype** adds support for HTML to unified.\n**retext** adds support for natural language to unified.\n**hast** is the HTML AST that rehype uses.\n**nlcst** is the natural language AST that retext uses.\nThis is a rehype plugin that transforms hast into nlcst to support retext.\n\n## When should I use this?\n\nThis project is useful if you want to check natural language in HTML.\nThe retext ecosystem has many useful plugins to check prose, such as\n[`retext-indefinite-article`][retext-indefinite-article] which checks that `a`\nand `an` are used correctly, or [`retext-readability`][retext-readability] which\nchecks that sentences are not too complex.\nThis plugins lets you use them on HTML documents.\n\nThis plugin is not able to apply changes by retext plugins (such\nas done by `retext-smartypants`) to the HTML content.\n\nThis plugin is built on [`hast-util-to-nlcst`][hast-util-to-nlcst], which does\nthe work on syntax trees.\nrehype focusses on making it easier to transform content by abstracting such\ninternals away.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install rehype-retext\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport rehypeRetext from 'https://esm.sh/rehype-retext@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import rehypeRetext from 'https://esm.sh/rehype-retext@5?bundle'\n</script>\n```\n\n## Use\n\nSay we have the following file `example.html`:\n\n```html\n<!doctype html>\n<meta charset=utf8>\n<title>Hello!</title>\n<article>\n  A implicit sentence.\n  <h1>This and and that.</h1>\n</article>\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport rehypeParse from 'rehype-parse'\nimport rehypePresetMinify from 'rehype-preset-minify'\nimport rehypeRetext from 'rehype-retext'\nimport rehypeStringify from 'rehype-stringify'\nimport retextEnglish from 'retext-english'\nimport retextIndefiniteArticle from 'retext-indefinite-article'\nimport retextRepeatedWords from 'retext-repeated-words'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await unified()\n  .use(rehypeParse)\n  .use(\n    rehypeRetext,\n    unified()\n      .use(retextEnglish)\n      .use(retextIndefiniteArticle)\n      .use(retextRepeatedWords)\n  )\n  .use(rehypePresetMinify)\n  .use(rehypeStringify)\n  .process(await read('example.html'))\n\nconsole.error(reporter([file]))\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```html\nexample.html\n5:3-5:4   warning Unexpected article `A` before `implicit`, expected `An` retext-indefinite-article retext-indefinite-article\n6:12-6:19 warning Unexpected repeated `and`, remove one occurrence        and                       retext-repeated-words\n\n⚠ 2 warnings\n```\n\n```html\n<!doctypehtml><meta charset=utf8><title>Hello!</title><article>A implicit sentence.<h1>This and and that.</h1></article>\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`rehypeRetext`][api-rehype-retext].\n\n### `unified().use(rehypeRetext, options)`\n\nBridge or mutate to retext.\n\n###### Parameters\n\n* `options` ([`Parser`][unified-parser] or [`Processor`][unified-processor])\n  — configuration (required)\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n###### Notes\n\n* if a [processor][unified-processor] is given, uses its parser to create a\n  new nlcst tree, then runs the plugins attached to with that\n  (*[bridge mode][unified-mode]*); you can add a parser to processor for\n  example with `retext-english`; other plugins used on the processor should\n  be retext plugins\n* if a [parser][unified-parser] is given, uses it to create a new nlcst tree,\n  and returns it (*[mutate mode][unified-mode]*); you can get a parser by\n  importing `Parser` from `retext-english` for example;  other plugins used\n  after `rehypeRetext` should be retext plugins\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\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, `rehype-retext@5`,\ncompatible with Node.js 16.\n\nThis plugin works with `unified` version 6+, `rehype` version 4+, and `retext`\nversion 7+.\n\n## Security\n\n`rehype-retext` does not change the syntax tree so there are no openings for\n[cross-site scripting (XSS)][xss] attacks.\n\n## Related\n\n* [`rehype-remark`](https://github.com/rehypejs/rehype-remark)\n  — rehype plugin to turn HTML into markdown\n* [`remark-retext`](https://github.com/remarkjs/remark-retext)\n  — remark plugin to support retext\n* [`remark-rehype`](https://github.com/remarkjs/remark-rehype)\n  — remark plugin to turn markdown into HTML\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`rehypejs/.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<!-- Definitions -->\n\n[build-badge]: https://github.com/rehypejs/rehype-retext/workflows/main/badge.svg\n\n[build]: https://github.com/rehypejs/rehype-retext/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-retext.svg\n\n[coverage]: https://codecov.io/github/rehypejs/rehype-retext\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-retext.svg\n\n[downloads]: https://www.npmjs.com/package/rehype-retext\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-retext\n\n[size]: https://bundlejs.com/?q=rehype-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-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/rehypejs/rehype/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[health]: https://github.com/rehypejs/.github\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[typescript]: https://www.typescriptlang.org\n\n[hast-util-to-nlcst]: https://github.com/syntax-tree/hast-util-to-nlcst\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[retext]: https://github.com/retextjs/retext\n\n[retext-indefinite-article]: https://github.com/retextjs/retext-indefinite-article\n\n[retext-readability]: https://github.com/retextjs/retext-readability\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-mode]: https://github.com/unifiedjs/unified#transforming-between-ecosystems\n\n[unified-parser]: https://github.com/unifiedjs/unified#parser\n\n[unified-processor]: https://github.com/unifiedjs/unified#processor\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-rehype-retext]: #unifieduserehyperetext-options\n","publish_time":1584274756519,"_cnpm_publish_time":1584274756519,"dist-tags":{"latest":"5.0.1"}}