micromark-extension-gfm-strikethrough
Advanced tools
Comparing version 1.0.7 to 2.0.0
@@ -5,3 +5,2 @@ export {gfmStrikethroughHtml} from './lib/html.js' | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
interface TokenTypeMap { | ||
@@ -8,0 +7,0 @@ strikethroughSequence: 'strikethroughSequence' |
@@ -5,8 +5,10 @@ /** | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM strikethrough when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
*/ | ||
export const gfmStrikethroughHtml: HtmlExtension | ||
export function gfmStrikethroughHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension |
@@ -5,21 +5,23 @@ /** | ||
// To do: next major: expose function instead of object. | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM strikethrough when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
*/ | ||
export const gfmStrikethroughHtml = { | ||
enter: { | ||
strikethrough() { | ||
this.tag('<del>') | ||
export function gfmStrikethroughHtml() { | ||
return { | ||
enter: { | ||
strikethrough() { | ||
this.tag('<del>') | ||
} | ||
}, | ||
exit: { | ||
strikethrough() { | ||
this.tag('</del>') | ||
} | ||
} | ||
}, | ||
exit: { | ||
strikethrough() { | ||
this.tag('</del>') | ||
} | ||
} | ||
} |
/** | ||
* Create an extension for `micromark` to enable GFM strikethrough syntax. | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* @param {Options | null | undefined} [options={}] | ||
* Configuration. | ||
@@ -25,3 +25,3 @@ * @returns {Extension} | ||
/** | ||
* Whether to support strikethrough with a single tilde. | ||
* Whether to support strikethrough with a single tilde (default: `true`). | ||
* | ||
@@ -31,3 +31,3 @@ * Single tildes work on github.com, but are technically prohibited by the | ||
*/ | ||
singleTilde?: boolean | ||
singleTilde?: boolean | null | undefined | ||
} |
@@ -12,4 +12,4 @@ /** | ||
* Configuration (optional). | ||
* @property {boolean} [singleTilde=true] | ||
* Whether to support strikethrough with a single tilde. | ||
* @property {boolean | null | undefined} [singleTilde=true] | ||
* Whether to support strikethrough with a single tilde (default: `true`). | ||
* | ||
@@ -20,9 +20,7 @@ * Single tildes work on github.com, but are technically prohibited by the | ||
import {ok as assert} from 'uvu/assert' | ||
import {ok as assert} from 'devlop' | ||
import {splice} from 'micromark-util-chunked' | ||
import {classifyCharacter} from 'micromark-util-classify-character' | ||
import {resolveAll} from 'micromark-util-resolve-all' | ||
import {codes} from 'micromark-util-symbol/codes.js' | ||
import {constants} from 'micromark-util-symbol/constants.js' | ||
import {types} from 'micromark-util-symbol/types.js' | ||
import {codes, constants, types} from 'micromark-util-symbol' | ||
@@ -32,3 +30,3 @@ /** | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* @param {Options | null | undefined} [options={}] | ||
* Configuration. | ||
@@ -35,0 +33,0 @@ * @returns {Extension} |
@@ -5,3 +5,2 @@ export {gfmStrikethroughHtml} from './lib/html.js' | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
interface TokenTypeMap { | ||
@@ -8,0 +7,0 @@ strikethroughSequence: 'strikethroughSequence' |
@@ -5,8 +5,10 @@ /** | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM strikethrough when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
*/ | ||
export const gfmStrikethroughHtml: HtmlExtension | ||
export function gfmStrikethroughHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension |
@@ -5,21 +5,23 @@ /** | ||
// To do: next major: expose function instead of object. | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM strikethrough when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions`, to | ||
* support GFM strikethrough when serializing to HTML. | ||
*/ | ||
export const gfmStrikethroughHtml = { | ||
enter: { | ||
strikethrough() { | ||
this.tag('<del>') | ||
export function gfmStrikethroughHtml() { | ||
return { | ||
enter: { | ||
strikethrough() { | ||
this.tag('<del>') | ||
} | ||
}, | ||
exit: { | ||
strikethrough() { | ||
this.tag('</del>') | ||
} | ||
} | ||
}, | ||
exit: { | ||
strikethrough() { | ||
this.tag('</del>') | ||
} | ||
} | ||
} |
/** | ||
* Create an extension for `micromark` to enable GFM strikethrough syntax. | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* @param {Options | null | undefined} [options={}] | ||
* Configuration. | ||
@@ -25,3 +25,3 @@ * @returns {Extension} | ||
/** | ||
* Whether to support strikethrough with a single tilde. | ||
* Whether to support strikethrough with a single tilde (default: `true`). | ||
* | ||
@@ -31,3 +31,3 @@ * Single tildes work on github.com, but are technically prohibited by the | ||
*/ | ||
singleTilde?: boolean | ||
singleTilde?: boolean | null | undefined | ||
} |
@@ -12,4 +12,4 @@ /** | ||
* Configuration (optional). | ||
* @property {boolean} [singleTilde=true] | ||
* Whether to support strikethrough with a single tilde. | ||
* @property {boolean | null | undefined} [singleTilde=true] | ||
* Whether to support strikethrough with a single tilde (default: `true`). | ||
* | ||
@@ -26,3 +26,3 @@ * Single tildes work on github.com, but are technically prohibited by the | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* @param {Options | null | undefined} [options={}] | ||
* Configuration. | ||
@@ -29,0 +29,0 @@ * @returns {Extension} |
{ | ||
"name": "micromark-extension-gfm-strikethrough", | ||
"version": "1.0.7", | ||
"version": "2.0.0", | ||
"description": "micromark extension to support GFM strikethrough", | ||
@@ -31,4 +31,2 @@ "license": "MIT", | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
@@ -45,15 +43,15 @@ "dev/", | ||
"dependencies": { | ||
"micromark-util-chunked": "^1.0.0", | ||
"micromark-util-classify-character": "^1.0.0", | ||
"micromark-util-resolve-all": "^1.0.0", | ||
"micromark-util-symbol": "^1.0.0", | ||
"micromark-util-types": "^1.0.0", | ||
"uvu": "^0.5.0" | ||
"devlop": "^1.0.0", | ||
"micromark-util-chunked": "^2.0.0", | ||
"micromark-util-classify-character": "^2.0.0", | ||
"micromark-util-resolve-all": "^2.0.0", | ||
"micromark-util-symbol": "^2.0.0", | ||
"micromark-util-types": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.0.0", | ||
"c8": "^7.0.0", | ||
"c8": "^8.0.0", | ||
"create-gfm-fixtures": "^1.0.0", | ||
"micromark": "^3.0.0", | ||
"micromark-build": "^1.0.0", | ||
"micromark": "^4.0.0", | ||
"micromark-build": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
@@ -78,18 +76,33 @@ "remark-cli": "^11.0.0", | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": false | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"remark-preset-wooorm" | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"ignoreCatch": true, | ||
"strict": true | ||
}, | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"n/file-extension-in-import": "off", | ||
"max-depth": "off", | ||
"unicorn/prefer-node-protocol": "off" | ||
"max-depth": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": "**/*.ts", | ||
"rules": { | ||
"@typescript-eslint/consistent-type-definitions": 0 | ||
} | ||
}, | ||
{ | ||
"files": "test/**/*.js", | ||
@@ -101,14 +114,3 @@ "rules": { | ||
] | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"remark-preset-wooorm" | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -21,3 +21,3 @@ # micromark-extension-gfm-strikethrough | ||
* [`gfmStrikethrough(options?)`](#gfmstrikethroughoptions) | ||
* [`gfmStrikethroughHtml`](#gfmstrikethroughhtml) | ||
* [`gfmStrikethroughHtml()`](#gfmstrikethroughhtml) | ||
* [`Options`](#options) | ||
@@ -57,3 +57,3 @@ * [Authoring](#authoring) | ||
This package is [ESM only][esm]. | ||
In Node.js (version 14.14+), install with [npm][]: | ||
In Node.js (version 16+), install with [npm][]: | ||
@@ -67,3 +67,3 @@ ```sh | ||
```js | ||
import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@1' | ||
import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@2' | ||
``` | ||
@@ -75,3 +75,3 @@ | ||
<script type="module"> | ||
import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@1?bundle' | ||
import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@2?bundle' | ||
</script> | ||
@@ -91,3 +91,3 @@ ``` | ||
extensions: [gfmStrikethrough()], | ||
htmlExtensions: [gfmStrikethroughHtml] | ||
htmlExtensions: [gfmStrikethroughHtml()] | ||
}) | ||
@@ -129,4 +129,9 @@ | ||
### `gfmStrikethroughHtml` | ||
### `gfmStrikethroughHtml()` | ||
Create an HTML extension for `micromark` to support GFM strikethrough when | ||
serializing to HTML. | ||
###### Returns | ||
Extension for `micromark` that can be passed in `htmlExtensions`, to support | ||
@@ -194,9 +199,12 @@ GFM strikethrough when serializing to HTML | ||
Projects maintained by the unified collective are compatible with all maintained | ||
Projects maintained by the unified collective are compatible with maintained | ||
versions of Node.js. | ||
As of now, that is Node.js 14.14+. | ||
Our projects sometimes work with older versions, but this is not guaranteed. | ||
These extensions work with `micromark` version 3+. | ||
When we cut a new major release, we drop support for unmaintained versions of | ||
Node. | ||
This means we try to keep the current release line, | ||
`micromark-extension-gfm-strikethrough@^2`, compatible with Node.js 16. | ||
This package works with `micromark` version `3` and later. | ||
## Security | ||
@@ -245,5 +253,5 @@ | ||
[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-gfm-strikethrough.svg | ||
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-strikethrough | ||
[size]: https://bundlephobia.com/result?p=micromark-extension-gfm-strikethrough | ||
[size]: https://bundlejs.com/?q=micromark-extension-gfm-strikethrough | ||
@@ -250,0 +258,0 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg |
29279
503
305
+ Addeddevlop@^1.0.0
+ Addeddevlop@1.1.0(transitive)
+ Addedmicromark-util-character@2.1.0(transitive)
+ Addedmicromark-util-chunked@2.0.0(transitive)
+ Addedmicromark-util-classify-character@2.0.0(transitive)
+ Addedmicromark-util-resolve-all@2.0.0(transitive)
+ Addedmicromark-util-symbol@2.0.0(transitive)
+ Addedmicromark-util-types@2.0.0(transitive)
- Removeduvu@^0.5.0
- Removeddiff@5.2.0(transitive)
- Removedkleur@4.1.5(transitive)
- Removedmicromark-util-character@1.2.0(transitive)
- Removedmicromark-util-chunked@1.1.0(transitive)
- Removedmicromark-util-classify-character@1.1.0(transitive)
- Removedmicromark-util-resolve-all@1.1.0(transitive)
- Removedmicromark-util-symbol@1.1.0(transitive)
- Removedmicromark-util-types@1.1.0(transitive)
- Removedmri@1.2.0(transitive)
- Removedsade@1.8.1(transitive)
- Removeduvu@0.5.6(transitive)
Updatedmicromark-util-symbol@^2.0.0
Updatedmicromark-util-types@^2.0.0