{"name":"mdast-util-gfm-autolink-literal","version":"0.1.2","description":"mdast extension to parse and serialize GFM autolink literals","license":"MIT","keywords":["unist","mdast","mdast-util","util","utility","markdown","markup","autolink","auto","link","literal","url","raw","gfm"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/mdast-util-gfm-autolink-literal.git"},"bugs":{"url":"https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{},"devDependencies":{"mdast-util-from-markdown":"^0.8.0","mdast-util-to-markdown":"^0.6.0","micromark-extension-gfm-autolink-literal":"^0.5.0","nyc":"^15.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","tape":"^5.0.0","xo":"^0.37.0"},"scripts":{"format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run test-coverage"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"aa87cc288350075cd2d3297e3d6cf4ebda807648","homepage":"https://github.com/syntax-tree/mdast-util-gfm-autolink-literal#readme","_id":"mdast-util-gfm-autolink-literal@0.1.2","_nodeVersion":"15.1.0","_npmVersion":"6.14.10","dist":{"integrity":"sha512-WFeIrcNNsfBety0gyWuiBIPing9UkVcl/m2iZOyW1uHEH2evjFocet2h77M24ub0WyZ4ucnQn/jWhO5Ozl6j4g==","shasum":"da69d700d42e0692a815292d47e8696926d70561","tarball":"http://registry-npm.ywwl.com/mdast-util-gfm-autolink-literal/download/mdast-util-gfm-autolink-literal-0.1.2.tgz","fileCount":6,"unpackedSize":10073,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8uilCRA9TVsSAnZWagAAWS4P/jwT7tNmx3l7LEogUKDK\nhcV57P17UGpD1b2Vf1953h1r07YftAg5u4N5OwODTzuWcMKKABN56yZAc+8d\n8jb9NkOwdAU/Qu9D94W8iFq2UMMB5tnvsoLyubkzA+nmsFe91EjEBGWOW3QA\nhm1m2H59UOAqOaixEuNx/YOEAkYlYk0y/9ADI9NMDwJyU5qncGd4kdJJfVjV\nM9NkPfN4EU68TyXwm3NSbbFQ06cJacJyzyknACRIAwHR+agaaKXN0XBLUvGE\nPHm0kmSlq/fNT2NBUyuQSAVIYAWpftfjntHvfAzdMDQbse5qQvo76+E64Leq\nl20J/fr+zhcY3r0cCjsx9kSkVZ6L4TwebdHfd2VsLKMEMGpqC7ZP5lr0jwi5\n/t/OtQVQnOv8mPruH1JyJ5TIVS1I3Lo9jNbfDvf1LYRGQmsyQ80C2RV56WJp\nN8JAvd4TCV15Aw6VkKXaQZJrZs37vqBNVtiyoqNJI+5tSlNGkl2573Y3NkfZ\nkK0Id+hEhCeEwHYf8Xg0/rddr0QZhtZvOgBIJ7rhoYwfUfNkurRazKkqeFds\nEc8cxJIsfhMRnSPnNfoHsHkJYXBYTQWUAc7AQ/3p652Uz38YBUDL7LbyW0b8\nEo/3VF3A6h6Il9JProTzclKY3if2EN9f9v3+F4XIgL1ZM0cvZRusFECwlZT3\n9geB\r\n=C5sS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByNa/3G7i2eZsdEfVGQ81ksgJrh/PLVlKDXWXQP73ZLAiEAqnMie0HgigkeJ109FmrkJHctIoXb7fAsKuBe6vsdaPA="}],"size":3551,"noattachment":false,"key":"/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mdast-util-gfm-autolink-literal_0.1.2_1609754788812_0.12218525418342208"},"_hasShrinkwrap":false,"readme":"# mdast-util-gfm-autolink-literal\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[mdast][] extensions to parse and serialize [GFM][] autolink literals.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When to use this](#when-to-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`gfmAutolinkLiteralFromMarkdown()`](#gfmautolinkliteralfrommarkdown)\n    *   [`gfmAutolinkLiteralToMarkdown()`](#gfmautolinkliteraltomarkdown)\n*   [HTML](#html)\n*   [Syntax](#syntax)\n*   [Syntax tree](#syntax-tree)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package contains two extensions that add support for GFM autolink literals\nsyntax in markdown to [mdast][].\nThese extensions plug into\n[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing\nGFM autolinks in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing\nGFM autolinks in syntax trees to markdown).\n\nGitHub employs different algorithms to autolink: one at parse time and one at\ntransform time (similar to how `@mentions` are done at transform time).\nThis difference can be observed because character references and escapes are\nhandled differently.\nBut also because issues/PRs/comments omit (perhaps by accident?) the second\nalgorithm for `www.`, `http://`, and `https://` links (but not for email links).\n\nAs the corresponding micromark extension\n[`micromark-extension-gfm-autolink-literal`][extension] is a syntax extension,\nit can only perform the first algorithm.\nThe tree extension `gfmAutolinkLiteralFromMarkdown` from this package can\nperform the second algorithm, and as they are combined, both are done.\n\n## When to use this\n\nYou can use these extensions when you are working with\n`mdast-util-from-markdown` and `mdast-util-to-markdown` already.\n\nWhen working with `mdast-util-from-markdown`, you must combine this package\nwith\n[`micromark-extension-gfm-autolink-literal`][extension].\n\nWhen you don’t need a syntax tree, you can use [`micromark`][micromark]\ndirectly with `micromark-extension-gfm-autolink-literal`.\n\nWhen you are working with syntax trees and want all of GFM, use\n[`mdast-util-gfm`][mdast-util-gfm] instead.\n\nAll these packages are used [`remark-gfm`][remark-gfm], which\nfocusses on making it easier to transform content by abstracting these\ninternals away.\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-gfm-autolink-literal\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown} from 'https://esm.sh/mdast-util-gfm-autolink-literal@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {gfmAutolinkLiteralFromMarkdown, gfmAutolinkLiteralToMarkdown} from 'https://esm.sh/mdast-util-gfm-autolink-literal@2?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\nwww.example.com, https://example.com, and contact@example.com.\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport {gfmAutolinkLiteral} from 'micromark-extension-gfm-autolink-literal'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {\n  gfmAutolinkLiteralFromMarkdown,\n  gfmAutolinkLiteralToMarkdown\n} from 'mdast-util-gfm-autolink-literal'\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\nconst doc = await fs.readFile('example.md')\n\nconst tree = fromMarkdown(doc, {\n  extensions: [gfmAutolinkLiteral()],\n  mdastExtensions: [gfmAutolinkLiteralFromMarkdown()]\n})\n\nconsole.log(tree)\n\nconst out = toMarkdown(tree, {extensions: [gfmAutolinkLiteralToMarkdown()]})\n\nconsole.log(out)\n```\n\n…now running `node example.js` yields (positional info removed for brevity):\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'paragraph',\n      children: [\n        {\n          type: 'link',\n          title: null,\n          url: 'http://www.example.com',\n          children: [{type: 'text', value: 'www.example.com'}]\n        },\n        {type: 'text', value: ', '},\n        {\n          type: 'link',\n          title: null,\n          url: 'https://example.com',\n          children: [{type: 'text', value: 'https://example.com'}]\n        },\n        {type: 'text', value: ', and '},\n        {\n          type: 'link',\n          title: null,\n          url: 'mailto:contact@example.com',\n          children: [{type: 'text', value: 'contact@example.com'}]\n        },\n        {type: 'text', value: '.'}\n      ]\n    }\n  ]\n}\n```\n\n```markdown\n[www.example.com](http://www.example.com), <https://example.com>, and <contact@example.com>.\n```\n\n## API\n\nThis package exports the identifiers\n[`gfmAutolinkLiteralFromMarkdown`][api-gfm-autolink-literal-from-markdown] and\n[`gfmAutolinkLiteralToMarkdown`][api-gfm-autolink-literal-to-markdown].\nThere is no default export.\n\n### `gfmAutolinkLiteralFromMarkdown()`\n\nCreate an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown]\nto enable GFM autolink literals in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable GFM autolink literals\n([`FromMarkdownExtension`][from-markdown-extension]).\n\n### `gfmAutolinkLiteralToMarkdown()`\n\nCreate an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to\nenable GFM autolink literals in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable GFM autolink literals\n([`ToMarkdownExtension`][to-markdown-extension]).\n\n## HTML\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\n\n## Syntax\n\nSee [Syntax in `micromark-extension-gfm-autolink-literal`][syntax].\n\n## Syntax tree\n\nThere are no interfaces added to **[mdast][]** by this utility, as it reuses\nthe existing **[Link][dfn-link]** interface.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt does not export additional types.\n\nThe `Link` type of the mdast nodes is exposed from `@types/mdast`.\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,\n`mdast-util-gfm-autolink-literal@^2`, compatible with Node.js 16.\n\nThis utility works with `mdast-util-from-markdown` version 2+ and\n`mdast-util-to-markdown` version 2+.\n\n## Related\n\n*   [`remarkjs/remark-gfm`][remark-gfm]\n    — remark plugin to support GFM\n*   [`syntax-tree/mdast-util-gfm`][mdast-util-gfm]\n    — same but all of GFM (autolink literals, footnotes, strikethrough, tables,\n    tasklists)\n*   [`micromark/micromark-extension-gfm-autolink-literal`][extension]\n    — micromark extension to parse GFM autolink literals\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to 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/syntax-tree/mdast-util-gfm-autolink-literal/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-autolink-literal.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-autolink-literal\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-autolink-literal.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-gfm-autolink-literal\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-autolink-literal\n\n[size]: https://bundlejs.com/?q=mdast-util-gfm-autolink-literal\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/syntax-tree/unist/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[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[micromark]: https://github.com/micromark/micromark\n\n[extension]: https://github.com/micromark/micromark-extension-gfm-autolink-literal\n\n[syntax]: https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax\n\n[gfm]: https://github.github.com/gfm/\n\n[dfn-link]: https://github.com/syntax-tree/mdast#link\n\n[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[api-gfm-autolink-literal-from-markdown]: #gfmautolinkliteralfrommarkdown\n\n[api-gfm-autolink-literal-to-markdown]: #gfmautolinkliteraltomarkdown\n","publish_time":1609754788989,"_cnpm_publish_time":1609754788989,"dist-tags":{"latest":"2.1.0"}}