{"_id":"mdast-util-gfm-autolink-literal@2.1.0","bugs":{"url":"https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/issues"},"dist":{"shasum":"858c0ad840c173aa54698a2fdbb507d9f1f4d67d","tarball":"http://registry-npm.ywwl.com/mdast-util-gfm-autolink-literal/download/mdast-util-gfm-autolink-literal-2.1.0.tgz","fileCount":9,"integrity":"sha512-Jx6QSK8wDo558Bcf7q+1pe0v81g2PVs09Hlvu9xJHmCFRF3sAPW7vXFVIAwBncs3sde92WbsVqNxwdqViA2XnQ==","signatures":[{"sig":"MEUCICjZ+5TZMA2i50HwhBURyPT+pSbswN24oITGpacEw5cjAiEApkxuiCJjFCZLm9+CHwqUYdDVgaIn/gqu4DM7AxAH3Tw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwDZYHKZ7qkAzmMD1ys5ycsdov5MEBTlO4r09Rw/vzRQIgQYhu5E+JM0O1CczUfzO54Nzzj8ZzKBTs9o7fpUb+Ep8="}],"unpackedSize":24809,"size":7290,"noattachment":false,"key":"/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.1.0.tgz"},"name":"mdast-util-gfm-autolink-literal","type":"module","types":"./index.d.ts","author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"b330cabd570eb9d2cfa78c2e1ccde72704617392","license":"MIT","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","test-api":"npm run test-api-dev && npm run test-api-prod","test-api-dev":"node --conditions development test/index.js","test-api-prod":"node --conditions production test/index.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"version":"2.1.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"homepage":"https://github.com/syntax-tree/mdast-util-gfm-autolink-literal#readme","keywords":["autolink","auto","gfm","link","literal","markdown","markup","mdast-util","mdast","raw","unist","url","utility","util"],"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-gfm-autolink-literal.git","type":"git"},"_npmVersion":"12.2.2","description":"mdast extension to parse and serialize GFM autolink literals","directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"sideEffects":false,"_nodeVersion":"26.12.1","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"ccount":"^2.0.0","devlop":"^1.0.0","@types/mdast":"^4.0.0","micromark-util-character":"^2.0.0","mdast-util-find-and-replace":"^3.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"strict":true,"atLeast":100},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","type-coverage":"^2.0.0","hast-util-to-html":"^9.0.0","mdast-util-to-hast":"^13.0.0","remark-preset-wooorm":"^11.0.0","mdast-util-to-markdown":"^2.0.0","mdast-util-from-markdown":"^2.0.0","micromark-extension-gfm-autolink-literal":"^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mdast-util-gfm-autolink-literal_2.1.0_1793959700661_0.5625984799042955"},"readme":"# mdast-util-gfm-autolink-literal\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n\n[mdast][github-mdast] extensions to parse and serialize\n[GFM][spec-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][github-mdast].\nThese extensions plug into\n[`mdast-util-from-markdown`][github-mdast-util-from-markdown]\n(to support parsing GFM autolinks in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][github-mdast-util-to-markdown]\n(to support serializing GFM 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`][github-micromark-extension]\nis 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`][github-micromark-extension].\n\nWhen you don’t need a syntax tree, you can use [`micromark`][github-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`][github-mdast-util-gfm] instead.\n\nAll these packages are used [`remark-gfm`][github-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`][github-mdast-util-to-hast].\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+), install with [npm][npmjs-install]:\n\n```sh\nnpm install mdast-util-gfm-autolink-literal\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 document = await fs.readFile('example.md', 'utf8')\n\nconst tree = fromMarkdown(document, {\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\n[`mdast-util-from-markdown`][github-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`][github-mdast-util-from-markdown-extension]).\n\n### `gfmAutolinkLiteralToMarkdown()`\n\nCreate an extension for\n[`mdast-util-to-markdown`][github-mdast-util-to-markdown]\nto enable GFM autolink literals in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable GFM autolink literals\n([`ToMarkdownExtension`][github-mdast-util-to-markdown-options]).\n\n## HTML\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][github-mdast-util-to-hast].\n\n## Syntax\n\nSee [Syntax in\n`micromark-extension-gfm-autolink-literal`][github-micromark-extension-syntax].\n\n## Syntax tree\n\nThere are no interfaces added to **[mdast][github-mdast]** by this utility,\nas it reuses the existing **[Link][github-mdast-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* [`remark-gfm`][github-remark-gfm]\n  — remark plugin to support GFM\n* [`mdast-util-gfm`][github-mdast-util-gfm]\n  — same but all of GFM (autolink literals, footnotes, strikethrough, tables,\n  tasklists)\n* [`micromark-extension-gfm-autolink-literal`][github-micromark-extension]\n  — micromark extension to parse GFM autolink literals\n\n## Contribute\n\nSee\n[`contributing.md`][health-contributing]\nin\n[`syntax-tree/.github`][health]\nfor ways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-gfm-autolink-literal-from-markdown]: #gfmautolinkliteralfrommarkdown\n\n[api-gfm-autolink-literal-to-markdown]: #gfmautolinkliteraltomarkdown\n\n[badge-build-image]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-autolink-literal.svg\n\n[badge-coverage-url]: https://codecov.io/github/syntax-tree/mdast-util-gfm-autolink-literal\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/mdast-util-gfm-autolink-literal.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/mdast-util-gfm-autolink-literal\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/mdast-util-gfm-autolink-literal\n\n[badge-size-url]: https://bundlejs.com/?q=mdast-util-gfm-autolink-literal\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-mdast]: https://github.com/syntax-tree/mdast\n\n[github-mdast-link]: https://github.com/syntax-tree/mdast#link\n\n[github-mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[github-mdast-util-from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[github-mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[github-mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[github-mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[github-mdast-util-to-markdown-options]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[github-micromark]: https://github.com/micromark/micromark\n\n[github-micromark-extension]: https://github.com/micromark/micromark-extension-gfm-autolink-literal\n\n[github-micromark-extension-syntax]: https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax\n\n[github-remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[health]: https://github.com/syntax-tree/.github\n\n[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[spec-gfm]: https://github.github.com/gfm/\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","publish_time":1793959700768,"_cnpm_publish_time":1793959700768,"dist-tags":{"latest":"2.1.0"}}