micromark-extension-gfm
Advanced tools
Comparing version 0.3.3 to 1.0.0
49
index.js
@@ -1,1 +0,48 @@ | ||
module.exports = require('./syntax') | ||
/** | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension | ||
* @typedef {import('micromark-extension-gfm-strikethrough').Options} Options | ||
*/ | ||
import { | ||
combineExtensions, | ||
combineHtmlExtensions | ||
} from 'micromark-util-combine-extensions' | ||
import { | ||
gfmAutolinkLiteral, | ||
gfmAutolinkLiteralHtml | ||
} from 'micromark-extension-gfm-autolink-literal' | ||
import { | ||
gfmStrikethrough, | ||
gfmStrikethroughHtml | ||
} from 'micromark-extension-gfm-strikethrough' | ||
import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table' | ||
import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter' | ||
import { | ||
gfmTaskListItem, | ||
gfmTaskListItemHtml | ||
} from 'micromark-extension-gfm-task-list-item' | ||
/** | ||
* Support GFM or markdown on github.com. | ||
* | ||
* @param {Options} [options] | ||
* @returns {Extension} | ||
*/ | ||
export function gfm(options) { | ||
return combineExtensions([ | ||
gfmAutolinkLiteral, | ||
gfmStrikethrough(options), | ||
gfmTable, | ||
gfmTaskListItem | ||
]) | ||
} | ||
/** @type {HtmlExtension} */ | ||
export const gfmHtml = combineHtmlExtensions([ | ||
gfmAutolinkLiteralHtml, | ||
gfmStrikethroughHtml, | ||
gfmTableHtml, | ||
gfmTagfilterHtml, | ||
gfmTaskListItemHtml | ||
]) |
{ | ||
"name": "micromark-extension-gfm", | ||
"version": "0.3.3", | ||
"version": "1.0.0", | ||
"description": "micromark extension to support GFM (GitHub Flavored Markdown)", | ||
@@ -29,44 +29,46 @@ "license": "MIT", | ||
], | ||
"types": "types/index.d.ts", | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"types/*.d.ts", | ||
"index.js", | ||
"html.js", | ||
"syntax.js" | ||
"index.d.ts", | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"micromark": "~2.11.0", | ||
"micromark-extension-gfm-autolink-literal": "~0.5.0", | ||
"micromark-extension-gfm-strikethrough": "~0.6.5", | ||
"micromark-extension-gfm-table": "~0.4.0", | ||
"micromark-extension-gfm-tagfilter": "~0.3.0", | ||
"micromark-extension-gfm-task-list-item": "~0.3.0" | ||
"micromark-extension-gfm-autolink-literal": "^1.0.0", | ||
"micromark-extension-gfm-strikethrough": "^1.0.0", | ||
"micromark-extension-gfm-table": "^1.0.0", | ||
"micromark-extension-gfm-tagfilter": "^1.0.0", | ||
"micromark-extension-gfm-task-list-item": "^1.0.0", | ||
"micromark-util-combine-extensions": "^1.0.0", | ||
"micromark-util-types": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"dtslint": "^4.0.0", | ||
"hast-util-select": "^4.0.0", | ||
"hast-util-to-text": "^2.0.0", | ||
"node-fetch": "^2.6.1", | ||
"nyc": "^15.0.0", | ||
"@types/hast": "^2.3.1", | ||
"@types/node-fetch": "^2.5.10", | ||
"@types/tape": "^4.0.0", | ||
"c8": "^7.0.0", | ||
"hast-util-select": "^5.0.0", | ||
"hast-util-to-text": "^3.0.0", | ||
"micromark": "^3.0.0", | ||
"node-fetch": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
"rehype-parse": "^7.0.1", | ||
"rehype-parse": "^7.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^4.0.0", | ||
"unified": "^9.0.0", | ||
"xo": "^0.38.0" | ||
"xo": "^0.39.0" | ||
}, | ||
"scripts": { | ||
"build": "rimraf \"*.d.ts\" \"script/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test/index.js", | ||
"test-types": "dtslint types", | ||
"test": "npm run format && npm run test-coverage && npm run test-types" | ||
"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": { | ||
@@ -81,11 +83,3 @@ "tabWidth": 2, | ||
"xo": { | ||
"prettier": true, | ||
"esnext": false, | ||
"ignores": [ | ||
"types" | ||
], | ||
"rules": { | ||
"guard-for-in": "off", | ||
"unicorn/no-array-for-each": "off" | ||
} | ||
"prettier": true | ||
}, | ||
@@ -96,3 +90,9 @@ "remarkConfig": { | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -17,8 +17,10 @@ # micromark-extension-gfm | ||
You probably shouldn’t use this package directly, but instead use | ||
[`mdast-util-gfm`][mdast-util-gfm] with **[mdast][]** or `remark-gfm` with | ||
**[remark][]**. | ||
## When to use this | ||
Alternatively, the extensions can be used separately: | ||
If you’re using [`micromark`][micromark] or | ||
[`mdast-util-from-markdown`][from-markdown], use this package. | ||
Alternatively, if you’re using **[remark][]**, use [`remark-gfm`][remark-gfm]. | ||
If you don’t need all of GFM, the extensions can be used separately: | ||
* [`micromark/micromark-extension-gfm-autolink-literal`](https://github.com/micromark/micromark-extension-gfm-autolink-literal) | ||
@@ -37,2 +39,5 @@ — support GFM [autolink literals][] | ||
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][]: | ||
@@ -74,19 +79,16 @@ | ||
And our script, `example.js`, looks as follows: | ||
And our module, `example.js`, looks as follows: | ||
```js | ||
var fs = require('fs') | ||
var micromark = require('micromark') | ||
var gfmSyntax = require('micromark-extension-gfm') | ||
var gfmHtml = require('micromark-extension-gfm/html') | ||
import fs from 'node:fs' | ||
import {micromark} from 'micromark' | ||
import {gfm, gfmHtml} from 'micromark-extension-gfm' | ||
var doc = fs.readFileSync('example.md') | ||
var result = micromark(doc, { | ||
const output = micromark(fs.readFileSync('example.md'), { | ||
allowDangerousHtml: true, | ||
extensions: [gfmSyntax()], | ||
extensions: [gfm()], | ||
htmlExtensions: [gfmHtml] | ||
}) | ||
console.log(result) | ||
console.log(output) | ||
``` | ||
@@ -124,17 +126,15 @@ | ||
### `html` | ||
This package exports the following identifiers: `gfm`, `gfmHtml`. | ||
There is no default export. | ||
### `syntax(options?)` | ||
### `gfm(options?)` | ||
> Note: `syntax` is the default export of this module, `html` is available at | ||
> `micromark-extension-gfm/html`. | ||
### `gfmHtml` | ||
Support [GFM][] or markdown on github.com. | ||
`gfm` is a function that can be called with options and returns an extension for | ||
micromark to parse GFM (can be passed in `extensions`). | ||
`gfmHtml` is an extension for micromark to compile as elements (can be passed in | ||
`htmlExtensions`). | ||
The export of `syntax` is a function that can be called with options and returns | ||
extension for the micromark parser (to tokenize GFM; can be passed in | ||
`extensions`). | ||
The export of html is an extension for the default HTML compiler (can be passed | ||
in `htmlExtensions`). | ||
##### `options` | ||
@@ -232,8 +232,6 @@ | ||
[mdast]: https://github.com/syntax-tree/mdast | ||
[remark-gfm]: https://github.com/remarkjs/remark-gfm | ||
[gfm]: https://github.github.com/gfm/ | ||
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm | ||
[strikethrough]: https://github.github.com/gfm/#strikethrough-extension- | ||
@@ -240,0 +238,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13146
61
1
Yes
7
18
5
245
+ Addedmicromark-util-types@^1.0.0
+ Addeddequal@2.0.3(transitive)
+ Addeddiff@5.2.0(transitive)
+ Addedkleur@4.1.5(transitive)
+ Addedmicromark-extension-gfm-autolink-literal@1.0.5(transitive)
+ Addedmicromark-extension-gfm-strikethrough@1.0.7(transitive)
+ Addedmicromark-extension-gfm-table@1.0.7(transitive)
+ Addedmicromark-extension-gfm-tagfilter@1.0.2(transitive)
+ Addedmicromark-extension-gfm-task-list-item@1.0.5(transitive)
+ Addedmicromark-factory-space@1.1.0(transitive)
+ Addedmicromark-util-character@1.2.0(transitive)
+ Addedmicromark-util-chunked@1.1.0(transitive)
+ Addedmicromark-util-classify-character@1.1.0(transitive)
+ Addedmicromark-util-combine-extensions@1.1.0(transitive)
+ Addedmicromark-util-encode@1.1.0(transitive)
+ Addedmicromark-util-resolve-all@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)
+ Addedmri@1.2.0(transitive)
+ Addedsade@1.8.1(transitive)
+ Addeduvu@0.5.6(transitive)
- Removedmicromark@~2.11.0
- 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)
- Removedmicromark-extension-gfm-autolink-literal@0.5.7(transitive)
- Removedmicromark-extension-gfm-strikethrough@0.6.5(transitive)
- Removedmicromark-extension-gfm-table@0.4.3(transitive)
- Removedmicromark-extension-gfm-tagfilter@0.3.0(transitive)
- Removedmicromark-extension-gfm-task-list-item@0.3.3(transitive)
- Removedms@2.1.3(transitive)
- Removedparse-entities@2.0.0(transitive)