{"name":"mdast-util-gfm-autolink-literal","version":"1.0.3","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"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/mdast":"^3.0.0","ccount":"^2.0.0","mdast-util-find-and-replace":"^2.0.0","micromark-util-character":"^1.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","hast-util-to-html":"^8.0.0","mdast-util-from-markdown":"^1.0.0","mdast-util-to-hast":"^12.0.0","mdast-util-to-markdown":"^1.0.0","micromark-extension-gfm-autolink-literal":"^1.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"},"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":"off"}}]},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"251fb3acd655539ba262f5ca916b18560d5df67a","homepage":"https://github.com/syntax-tree/mdast-util-gfm-autolink-literal#readme","_id":"mdast-util-gfm-autolink-literal@1.0.3","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==","shasum":"67a13abe813d7eba350453a5333ae1bc0ec05c06","tarball":"http://registry-npm.ywwl.com/mdast-util-gfm-autolink-literal/download/mdast-util-gfm-autolink-literal-1.0.3.tgz","fileCount":7,"unpackedSize":21490,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFsuFqlJrwEkVqV+QC4TXEnL/O/ZsHT1jUgm1hr3T20CAiAYxYfG+emzAzjp+6crgSeSWPZNqS3ZJ/53hB0n7RlgzA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1qwDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLRA/+OtEnusKjbFxg9iM0Ni3IpRWudAKYwX5MMtMIe95bSj0fage4\r\nCqA8Y2Jbcs6tjkh2Tptzx3MlrtBNVnX0yp4g76Lu77XhTAvNq5RS5JcnPqw8\r\neYcO/rM4HzOJ83xgbdrH1l+8fiu4YjlrreIwIgfZ8RmS0jBa8KBs2CuK1/NG\r\nLxg1z40az90NpvLcCQfBhq1MO9SFH7EMG5+LYb4ruSNx1n8l3TDnMFo9SwT0\r\nVYlfphLJXPwMHh809Q+MhSGnLUcCrsPDMcIXjv6ZuZD2fB4R1uzbv4fwLVBA\r\nFP6cEFrCsOuBUgn3GjrObA6yo+/1MPOtrbCHGluLYyOdIPhnCxhqAPEh9MZN\r\n3ORC/AffdUyZORG05jscWEO1uvgWCXA1VA84Pe93VdytuSKs4CXH5UjZI9sR\r\nPdANLIEICZ2N11i8jo6IeFHNrGG9dAIr4YLu7yFDP13rg2JLtfaF/5OYih10\r\neytkXCqYOF9CyvgWwadAV3alscruBOXIOub0uO55fTgcByicZbrUjNSNRMG2\r\nqzvb5Agsd3cf/l7G27QLCS1VIL6DbMbRDMPRgJAgL8tK5gEqkNMjSiFKvw+u\r\n1voecVkZztrzKq3eOX/qnqXPQSOyQXdXOThJe+jDVL9CFkdF1RO1B5c/G1PJ\r\nFQ667NUSVhdatnWWFFTdCDr+ye0DjJmDEo0=\r\n=UOiW\r\n-----END PGP SIGNATURE-----\r\n","size":6568,"noattachment":false,"key":"/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-1.0.3.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_1.0.3_1675013123652_0.9665833319098935"},"_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":1675013123792,"_cnpm_publish_time":1675013123792,"dist-tags":{"latest":"2.1.0"}}