{"name":"rehype-retext","version":"3.0.0","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@3.0.0","maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"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":{"prettier":true},"dist":{"shasum":"de9943be866d18e81952fc1a5f9fc90e7ba695c4","tarball":"http://registry-npm.ywwl.com/rehype-retext/download/rehype-retext-3.0.0.tgz","fileCount":5,"integrity":"sha512-AXjWckHyp686XmFOsXLswuZJUanRv6x1NNJ6/20ocKvmP27mNbFd0TRfzG9b3IcY6IPRqTnr8ntrWPoCNvb1Rw==","signatures":[{"sig":"MEUCIGHoFW4G9bKAfD0VXhVwFH3sgy7YYdU/fH7dGSApLfrMAiEAmJRwtuh8ie1kpRHtiKIq0SQSREp88ctaUPAN69ZCS/w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12226,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhB5a0CRA9TVsSAnZWagAAjjwQAIHa8tdZ/MqpR513CAtV\nsTmiufLOTJeT7QE8I1Ltj5TBuGV+jpWtVwX3hGVkaETY0KXKwlzjyk+rV1An\ndO28Zdwx0Z3IUHj9xDNZF0GQXUoCAPCCtLo8ICcg6UWUSbB6Ak03/Fd+hXp1\np0kaSSoweZXp9dNQOMx/REkPyf41oXGryOCbOW5PeqrTX5TY4gLQdcqBNOyT\ngKfd5TbiGLoywVoF0neZ/kSNPob6cmr0zkJ5o/YzDFY1JisBiIAnfRFeDORM\nXIXGsB306xsoApIowCwCPeQVnaoO1WerthmewqtHnDS6QII5dAPwcEDzMPo0\nC+1iZP6BZkdI3s8RnytdvcKQz4c/d0nr6jBTn5WqMkir9lv7UMvU9T40DmES\ny6rrA0l5u1ok05XiZIQFFnKQPL8yBPBZWlPivo0yrTbQ7sDi0+FWHOwur6Lf\nA3BJv8zngzYf/X9StFbh28ZQo7fGd9CfzFraG973+j7ClkqSYGedKs32BM+f\n+RF4RzvdmTbQ+Xbtq9gDAMeVdyaD3uFEZNkukQJQr/jMtVFtO9DQdLyLcpQK\nIsEcxBnzZMwgCGIPylYGnhXysd6OFa1Q7b3IzA3dND8oLzWQRmkh+dZAjteu\nJsfU+csv8oTfV8Gr1WEVSdgWL4gEK49mpx5QAYMF71WBA6x/DGTNcnpnaeLl\neMRN\r\n=d1dW\r\n-----END PGP SIGNATURE-----\r\n","size":4421,"noattachment":false,"key":"/rehype-retext/-/rehype-retext-3.0.0.tgz"},"main":"index.js","type":"module","types":"index.d.ts","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"ecd82a7f50db40c14e1f1951a123eebb6cbc955e","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development 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":"7.19.1","description":"rehype plugin to transform to retext","directories":{},"sideEffects":false,"_nodeVersion":"16.6.0","dependencies":{"unified":"^10.0.0","@types/hast":"^2.0.0","@types/unist":"^2.0.0","hast-util-to-nlcst":"^2.0.0"},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"#":"needed `any`s","detail":true,"strict":true,"atLeast":100,"ignoreCatch":true,"ignoreFiles":["index.d.ts","index.js"]},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.0.0","xo":"^0.42.0","tape":"^5.0.0","rimraf":"^3.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","typescript":"^4.0.0","@types/tape":"^4.0.0","rehype-parse":"^8.0.0","type-coverage":"^2.0.0","retext-english":"^4.0.0","rehype-stringify":"^9.0.0","retext-stringify":"^3.0.0","remark-preset-wooorm":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-retext_3.0.0_1627887283958_0.9007185794700132","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":1627887284082,"_cnpm_publish_time":1627887284082,"dist-tags":{"latest":"5.0.1"}}