micromark-extension-gfm-autolink-literal
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -607,3 +607,3 @@ /** | ||
/** | ||
* @param {Event[]} events | ||
* @param {Array<Event>} events | ||
* @returns {boolean} | ||
@@ -610,0 +610,0 @@ */ |
@@ -604,3 +604,3 @@ /** | ||
/** | ||
* @param {Event[]} events | ||
* @param {Array<Event>} events | ||
* @returns {boolean} | ||
@@ -607,0 +607,0 @@ */ |
{ | ||
"name": "micromark-extension-gfm-autolink-literal", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "micromark extension to support GFM autolink literals", | ||
@@ -52,5 +52,7 @@ "license": "MIT", | ||
"c8": "^7.0.0", | ||
"create-gfm-fixtures": "^1.0.0", | ||
"micromark": "^3.0.0", | ||
"micromark-build": "^1.0.0", | ||
"prettier": "^2.0.0", | ||
"rehype": "^12.0.0", | ||
"remark-cli": "^10.0.0", | ||
@@ -62,3 +64,3 @@ "remark-preset-wooorm": "^9.0.0", | ||
"typescript": "^4.0.0", | ||
"xo": "^0.45.0" | ||
"xo": "^0.47.0" | ||
}, | ||
@@ -83,2 +85,4 @@ "scripts": { | ||
"rules": { | ||
"no-await-in-loop": "off", | ||
"no-control-regex": "off", | ||
"node/file-extension-in-import": "off", | ||
@@ -85,0 +89,0 @@ "unicorn/no-this-assignment": "off", |
114
readme.md
@@ -14,5 +14,7 @@ # micromark-extension-gfm-autolink-literal | ||
This syntax extension matches the GFM spec and how literal autolinks work | ||
in several places on github.com. | ||
GitHub employs two algorithms to autolink: one at parse time and one at | ||
## What is this? | ||
This package is a micromark extension to add support for GFM literal autolinks. | ||
GitHub employs different algorithms to autolink: one at parse time and one at | ||
transform time (similar to how @mentions are done at transform time). | ||
@@ -25,20 +27,26 @@ This difference can be observed because character references and escapes are | ||
As this is a syntax extension, it focuses on the first algorithm. | ||
The `html` part of this extension does not operate on an AST and hence can’t | ||
perform the second algorithm. | ||
[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal] adds | ||
support for the second. | ||
The second algorithm is performed by | ||
[`mdast-util-gfm-autolink-literal`][mdast-autolink-literal]. | ||
The `html` part of this micromark extension does not operate on an AST and hence | ||
can’t perform the second algorithm. | ||
## When to use this | ||
You should probably use [`micromark-extension-gfm`][micromark-extension-gfm], | ||
which combines this package with other GFM features, instead. | ||
Alternatively, if you don’t want all of GFM, use this package. | ||
In many cases, when working with micromark, you’d want to use | ||
[`micromark-extension-gfm`][micromark-extension-gfm] instead, which combines | ||
this package with other GFM features. | ||
When working with syntax trees, you’d want to combine this package with | ||
[`mdast-util-gfm-autolink-literal`][mdast-autolink-literal] (or | ||
[`mdast-util-gfm`][mdast-util-gfm] when using `micromark-extension-gfm`). | ||
These tools are all rather low-level. | ||
In most cases, you’d instead want to use [`remark-gfm`][remark-gfm] with | ||
[remark][]. | ||
## Install | ||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): | ||
Node 12+ is needed to use it and it must be `import`ed instead of `require`d. | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
[npm][]: | ||
```sh | ||
@@ -48,2 +56,16 @@ npm install micromark-extension-gfm-autolink-literal | ||
In Deno with [Skypack][]: | ||
```js | ||
import {gfmAutolinkLiteral, gfmAutolinkLiteralHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-autolink-literal@1?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import {gfmAutolinkLiteral, gfmAutolinkLiteralHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-autolink-literal@1?min' | ||
</script> | ||
``` | ||
## Use | ||
@@ -79,3 +101,3 @@ | ||
The export map supports the endorsed | ||
[`development` condition](https://nodejs.org/api/packages.html#packages\_resolving\_user\_conditions). | ||
[`development` condition](https://nodejs.org/api/packages.html#packages_resolving_user_conditions). | ||
Run `node --conditions development module.js` to get instrumented dev code. | ||
@@ -86,26 +108,32 @@ Without this condition, production code is loaded. | ||
An extension for micromark to parse GFM autolink literals (can be passed in | ||
`extensions`). | ||
### `gfmAutolinkLiteralHtml` | ||
An extension for the micromark parser (to parse; can be passed in | ||
`extensions`) and one for the HTML compiler (to compile as `<a>` elements; can | ||
be passed in `htmlExtensions`). | ||
An extension to compile them to HTML (can be passed in `htmlExtensions`). | ||
## Types | ||
This package is fully typed with [TypeScript][]. | ||
There are no additional exported types. | ||
## Compatibility | ||
This package is at least compatible with all maintained versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
It also works in Deno and modern browsers. | ||
## Security | ||
This package is safe. | ||
## Related | ||
* [`remarkjs/remark`][remark] | ||
— markdown processor powered by plugins | ||
* [`remarkjs/remark-gfm`](https://github.com/remarkjs/remark-gfm) | ||
— remark plugin using this and other GFM features | ||
* [`micromark/micromark`][micromark] | ||
— the smallest commonmark-compliant markdown parser that exists | ||
* [`micromark/micromark-extension-gfm`][micromark-extension-gfm] | ||
— micromark extension combining this with other GFM features | ||
* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal) | ||
— mdast utility to support autolink literals | ||
* [`syntax-tree/mdast-util-gfm`](https://github.com/syntax-tree/mdast-util-gfm) | ||
— mdast utility to support GFM | ||
* [`syntax-tree/mdast-util-from-markdown`][from-markdown] | ||
— mdast parser using `micromark` to create mdast from markdown | ||
* [`syntax-tree/mdast-util-to-markdown`][to-markdown] | ||
— mdast serializer to create markdown from mdast | ||
* [`syntax-tree/mdast-util-gfm-autolink-literal`][mdast-autolink-literal] | ||
— support GFM autolink literals in mdast | ||
* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm] | ||
— support GFM in mdast | ||
* [`remarkjs/remark-gfm`][remark-gfm] | ||
— support GFM in remark | ||
@@ -156,2 +184,4 @@ ## Contribute | ||
[skypack]: https://www.skypack.dev | ||
[license]: license | ||
@@ -167,14 +197,18 @@ | ||
[micromark]: https://github.com/micromark/micromark | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown | ||
[typescript]: https://www.typescriptlang.org | ||
[to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown | ||
[micromark]: https://github.com/micromark/micromark | ||
[remark]: https://github.com/remarkjs/remark | ||
[mdast-util-gfm-autolink-literal]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal | ||
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm | ||
[mdast-autolink-literal]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal | ||
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm | ||
[remark-gfm]: https://github.com/remarkjs/remark-gfm | ||
[literal autolinks]: https://github.github.com/gfm/#autolinks-extension- | ||
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41912
208
14