micromark-extension-gfm-autolink-literal
Advanced tools
Comparing version 0.5.7 to 1.0.0
@@ -1,1 +0,2 @@ | ||
module.exports = require('./syntax') | ||
export {gfmAutolinkLiteral} from './lib/syntax.js' | ||
export {gfmAutolinkLiteralHtml} from './lib/html.js' |
{ | ||
"name": "micromark-extension-gfm-autolink-literal", | ||
"version": "0.5.7", | ||
"version": "1.0.0", | ||
"description": "micromark extension to support GFM autolink literals", | ||
@@ -28,30 +28,43 @@ "license": "MIT", | ||
], | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"html.js", | ||
"syntax.js" | ||
"dev/", | ||
"lib/", | ||
"index.d.ts", | ||
"index.js" | ||
], | ||
"exports": { | ||
"development": "./dev/index.js", | ||
"default": "./index.js" | ||
}, | ||
"dependencies": { | ||
"micromark": "~2.11.3" | ||
"micromark-util-character": "^1.0.0", | ||
"micromark-util-sanitize-uri": "^1.0.0", | ||
"micromark-util-symbol": "^1.0.0", | ||
"micromark-util-types": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"nyc": "^15.0.0", | ||
"@types/tape": "^4.0.0", | ||
"c8": "^7.0.0", | ||
"micromark": "^3.0.0", | ||
"micromark-build": "^1.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"xo": "^0.38.0" | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^4.0.0", | ||
"xo": "^0.40.0" | ||
}, | ||
"scripts": { | ||
"build": "rimraf \"dev/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage && micromark-build", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test/index.js", | ||
"test": "npm run format && npm run test-coverage" | ||
"test-api": "node --conditions development test/index.js", | ||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test/index.js", | ||
"test": "npm run build && npm run format && npm run test-coverage" | ||
}, | ||
"nyc": { | ||
"check-coverage": true, | ||
"lines": 100, | ||
"functions": 100, | ||
"branches": 100 | ||
}, | ||
"prettier": { | ||
@@ -67,5 +80,5 @@ "tabWidth": 2, | ||
"prettier": true, | ||
"esnext": false, | ||
"rules": { | ||
"unicorn/no-this-assignment": "off" | ||
"unicorn/no-this-assignment": "off", | ||
"unicorn/prefer-node-protocol": "off" | ||
} | ||
@@ -77,3 +90,9 @@ }, | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -11,3 +11,3 @@ # micromark-extension-gfm-autolink-literal | ||
**[micromark][]** extension to support GitHub flavored markdown [literal | ||
**[micromark][]** extension to support GitHub flavored markdown (GFM) [literal | ||
autolinks][]. | ||
@@ -17,6 +17,6 @@ | ||
in several places on github.com. | ||
Do note that GH employs two algorithms to autolink: one at parse time, | ||
one at compile time (similar to how @mentions are done at compile time). | ||
This difference can be observed because character references and escapes | ||
are handled differently. | ||
GitHub employs two algorithms to autolink: one at parse time and one at | ||
transform time (similar to how @mentions are done at transform time). | ||
This difference can be observed because character references and escapes are | ||
handled differently. | ||
But also because issues/PRs/comments omit (perhaps by accident?) the second | ||
@@ -28,12 +28,16 @@ algorithm for `www.`, `http://`, and `https://` links (but not for email links). | ||
perform the second algorithm. | ||
`mdast-util-gfm-autolink-literal` adds support for the second. | ||
[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal] adds | ||
support for the second. | ||
This package provides the low-level modules for integrating with the micromark | ||
tokenizer and the micromark HTML compiler. | ||
## When to use this | ||
You probably should use this package with | ||
[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal]. | ||
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. | ||
## 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. | ||
[npm][]: | ||
@@ -45,16 +49,44 @@ | ||
## Use | ||
```js | ||
import {micromark} from 'micromark' | ||
import { | ||
gfmAutolinkLiteral, | ||
gfmAutolinkLiteralHtml | ||
} from 'micromark-extension-gfm-autolink-literal' | ||
const output = micromark('Just a URL: www.example.com.', { | ||
extensions: [gfmAutolinkLiteral], | ||
htmlExtensions: [gfmAutolinkLiteralHtml] | ||
}) | ||
console.log(output) | ||
``` | ||
Yields: | ||
```html | ||
<p>Just a URL: <a href="http://www.example.com">www.example.com</a>.</p> | ||
``` | ||
## API | ||
### `html` | ||
This package exports the following identifiers: `gfmAutolinkLiteral`, | ||
`gfmAutolinkLiteralHtml`. | ||
There is no default export. | ||
### `syntax` | ||
The export map supports the endorsed | ||
[`development` condition](https://nodejs.org/api/packages.html#packages_resolving_user_conditions). | ||
Run `node --conditions development module.js` to get instrumented dev code. | ||
Without this condition, production code is loaded. | ||
> Note: `syntax` is the default export of this module, `html` is available at | ||
> `micromark-extension-gfm-autolink-literal/html`. | ||
### `gfmAutolinkLiteral` | ||
Support [literal autolinks][]. | ||
The exports are extensions for the micromark parser (to tokenize; can be passed | ||
in `extensions`) and the default HTML compiler (to compile as `<a>` elements; | ||
can be passed in `htmlExtensions`). | ||
### `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`). | ||
## Related | ||
@@ -64,6 +96,12 @@ | ||
— 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] | ||
@@ -139,1 +177,3 @@ — mdast parser using `micromark` to create mdast from markdown | ||
[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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41335
15
1189
1
174
Yes
4
12
1
+ Addedmicromark-util-symbol@^1.0.0
+ Addedmicromark-util-types@^1.0.0
+ Addedmicromark-util-character@1.2.0(transitive)
+ Addedmicromark-util-encode@1.1.0(transitive)
+ Addedmicromark-util-sanitize-uri@1.2.0(transitive)
+ Addedmicromark-util-symbol@1.1.0(transitive)
+ Addedmicromark-util-types@1.1.0(transitive)
- Removedmicromark@~2.11.3
- Removedcharacter-entities@1.2.4(transitive)
- Removedcharacter-entities-legacy@1.1.4(transitive)
- Removedcharacter-reference-invalid@1.1.4(transitive)
- Removeddebug@4.3.7(transitive)
- Removedis-alphabetical@1.0.4(transitive)
- Removedis-alphanumerical@1.0.4(transitive)
- Removedis-decimal@1.0.4(transitive)
- Removedis-hexadecimal@1.0.4(transitive)
- Removedmicromark@2.11.4(transitive)
- Removedms@2.1.3(transitive)
- Removedparse-entities@2.0.0(transitive)