{"name":"rehype-retext","version":"1.0.0","keywords":["rehype","retext","hast","nlcst"],"author":{"url":"http://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"rehype-retext@1.0.0","maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"contributors":[{"url":"http://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/wooorm/rehype-retext#readme","bugs":{"url":"https://github.com/wooorm/rehype-retext/issues"},"xo":{"space":true,"ignores":["rehype-retext.js"]},"nyc":{"lines":100,"branches":100,"functions":100,"check-coverage":true},"dist":{"shasum":"9b72a9bcef189122b4485d4f04426d4a9f0bcfaf","tarball":"http://registry-npm.ywwl.com/rehype-retext/download/rehype-retext-1.0.0.tgz","integrity":"sha512-VP21SNJSD7iZQgT/er+D/CRRKUtQxFUlTQz3C9dRw6KvwoRldhD9eKpBpO0vBPJhlGjGFURqHY9TuFizv43APg==","signatures":[{"sig":"MEUCICHL4EsvpC1Ahc0bYudtwJqyPAl7x1tKlCGSj5fQNCsYAiEA/5+/gX9JSZjBxRydpZp/ZyTpkpFwNsbT3SOfsOwezEg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3172,"noattachment":false,"key":"/rehype-retext/-/rehype-retext-1.0.0.tgz"},"_from":".","files":["index.js"],"_shasum":"9b72a9bcef189122b4485d4f04426d4a9f0bcfaf","gitHead":"b61340828ff3b9b300aafc21292b7dc095f597a7","scripts":{"lint":"xo","test":"npm run build && npm run lint && npm run test-coverage","build":"npm run build-md && npm run build-bundle && npm run build-mangle","build-md":"remark . --quiet --frail","test-api":"node test.js","build-bundle":"browserify index.js --bare -s rehypeRetext > rehype-retext.js","build-mangle":"esmangle rehype-retext.js > rehype-retext.min.js","test-coverage":"nyc --reporter lcov tape test.js"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"repository":{"url":"git+https://github.com/wooorm/rehype-retext.git","type":"git"},"_npmVersion":"3.3.6","description":"retext support for rehype","directories":{},"_nodeVersion":"5.0.0","dependencies":{"hast-util-to-nlcst":"^1.0.0"},"remarkConfig":{"output":true,"presets":"wooorm"},"devDependencies":{"xo":"^0.16.0","nyc":"^8.3.0","tape":"^4.0.0","unified":"^5.0.0","esmangle":"^1.0.1","browserify":"^13.0.1","remark-cli":"^2.0.0","rehype-parse":"^2.0.0","retext-english":"^2.0.0","rehype-stringify":"^2.0.0","retext-stringify":"^1.0.0","remark-preset-wooorm":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-retext-1.0.0.tgz_1475011992208_0.18496863963082433","host":"packages-12-west.internal.npmjs.com"},"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":1475011994072,"_cnpm_publish_time":1475011994072,"dist-tags":{"latest":"5.0.1"}}