Socket
Socket
Sign inDemoInstall

micromark-extension-gfm-footnote

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-gfm-footnote - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

6

dev/index.d.ts

@@ -10,3 +10,2 @@ export {gfmFootnote} from './lib/syntax.js'

declare module 'micromark-util-types' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface TokenTypeMap {

@@ -26,3 +25,6 @@ gfmFootnoteCall: 'gfmFootnoteCall'

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface ParseContext {
gfmFootnotes?: string[]
}
interface CompileData {

@@ -29,0 +31,0 @@ gfmFootnoteDefinitions?: Record<string, string>

@@ -20,4 +20,4 @@ /**

*
* @param {Options | null | undefined} [options]
* Configuration.
* @param {Options | null | undefined} [options={}]
* Configuration (optional).
* @returns {HtmlExtension}

@@ -62,5 +62,4 @@ * Extension for `micromark` that can be passed in `htmlExtensions` to

* Prefix to use before the `id` attribute on footnotes to prevent them from
* *clobbering*.
* *clobbering* (default: `'user-content-'`).
*
* The default is `'user-content-'`.
* Pass `''` for trusted markdown and when you are careful with

@@ -84,7 +83,6 @@ * polyfilling.

*/
clobberPrefix?: string
clobberPrefix?: string | null | undefined
/**
* Textual label to use for the footnotes section.
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* The default value is `'Footnotes'`.
* Change it when the markdown is not in English.

@@ -97,5 +95,5 @@ *

*/
label?: string
label?: string | null | undefined
/**
* Attributes to use on the footnote label.
* Attributes to use on the footnote label (default: `'class="sr-only"'`).
*

@@ -113,5 +111,5 @@ * Change it to show the label and add other attributes.

*/
labelAttributes?: string
labelAttributes?: string | null | undefined
/**
* HTML tag name to use for the footnote label element.
* HTML tag name to use for the footnote label element (default: `'h2'`).
*

@@ -125,5 +123,6 @@ * Change it to match your document structure.

*/
labelTagName?: string
labelTagName?: string | null | undefined
/**
* Textual label to describe the backreference back to references.
* Textual label to describe the backreference back to references (default:
* `defaultBackLabel`).
*

@@ -148,3 +147,3 @@ * The default value is:

*/
backLabel?: BackLabelTemplate | string
backLabel?: BackLabelTemplate | string | null | undefined
}

@@ -38,7 +38,6 @@ /**

* Configuration.
* @property {string} [clobberPrefix='user-content-']
* @property {string | null | undefined} [clobberPrefix='user-content-']
* Prefix to use before the `id` attribute on footnotes to prevent them from
* *clobbering*.
* *clobbering* (default: `'user-content-'`).
*
* The default is `'user-content-'`.
* Pass `''` for trusted markdown and when you are careful with

@@ -61,6 +60,5 @@ * polyfilling.

* Using a prefix solves these problems.
* @property {string} [label='Footnotes']
* Textual label to use for the footnotes section.
* @property {string | null | undefined} [label='Footnotes']
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* The default value is `'Footnotes'`.
* Change it when the markdown is not in English.

@@ -72,4 +70,4 @@ *

* pass different attributes with the `labelAttributes` option.
* @property {string} [labelAttributes='class="sr-only"']
* Attributes to use on the footnote label.
* @property {string | null | undefined} [labelAttributes='class="sr-only"']
* Attributes to use on the footnote label (default: `'class="sr-only"'`).
*

@@ -86,4 +84,4 @@ * Change it to show the label and add other attributes.

* > calls use it with `aria-describedby` to provide an accessible label.
* @property {string} [labelTagName='h2']
* HTML tag name to use for the footnote label element.
* @property {string | null | undefined} [labelTagName='h2']
* HTML tag name to use for the footnote label element (default: `'h2'`).
*

@@ -96,4 +94,5 @@ * Change it to match your document structure.

* pass different attributes with the `labelAttributes` option.
* @property {BackLabelTemplate | string} [backLabel]
* Textual label to describe the backreference back to references.
* @property {BackLabelTemplate | string | null | undefined} [backLabel]
* Textual label to describe the backreference back to references (default:
* `defaultBackLabel`).
*

@@ -119,3 +118,3 @@ * The default value is:

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {normalizeIdentifier} from 'micromark-util-normalize-identifier'

@@ -152,4 +151,4 @@ import {sanitizeUri} from 'micromark-util-sanitize-uri'

*
* @param {Options | null | undefined} [options]
* Configuration.
* @param {Options | null | undefined} [options={}]
* Configuration (optional).
* @returns {HtmlExtension}

@@ -209,5 +208,3 @@ * Extension for `micromark` that can be passed in `htmlExtensions` to

gfmFootnoteDefinitionLabelString(token) {
let footnoteStack = /** @type {Array<string>} */ (
this.getData('gfmFootnoteDefinitionStack')
)
let footnoteStack = this.getData('gfmFootnoteDefinitionStack')

@@ -264,11 +261,5 @@ if (!footnoteStack) {

null() {
const calls = /** @type {Array<string>} */ (
this.getData('gfmFootnoteCallOrder') || []
)
const counts = /** @type {Record<string, number>} */ (
this.getData('gfmFootnoteCallCounts') || {}
)
const definitions = /** @type {Record<string, string>} */ (
this.getData('gfmFootnoteDefinitions') || {}
)
const calls = this.getData('gfmFootnoteCallOrder') || []
const counts = this.getData('gfmFootnoteCallCounts') || {}
const definitions = this.getData('gfmFootnoteDefinitions') || {}
let index = -1

@@ -327,9 +318,6 @@

this.tag(
definitions[id].replace(
/<\/p>(?:\r?\n|\r)?$/,
(/** @type {string} */ $0) => {
injected = true
return ' ' + reference + $0
}
)
definitions[id].replace(/<\/p>(?:\r?\n|\r)?$/, function ($0) {
injected = true
return ' ' + reference + $0
})
)

@@ -336,0 +324,0 @@

@@ -12,10 +12,8 @@ /**

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {blankLine} from 'micromark-core-commonmark'
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEndingOrSpace} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol/codes.js'
import {constants} from 'micromark-util-symbol/constants.js'
import {normalizeIdentifier} from 'micromark-util-normalize-identifier'
import {types} from 'micromark-util-symbol/types.js'
import {codes, constants, types} from 'micromark-util-symbol'

@@ -66,4 +64,2 @@ const indent = {tokenize: tokenizeIndent, partial: true}

let index = self.events.length
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -211,4 +207,2 @@ /** @type {Token} */

const self = this
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -346,4 +340,2 @@ let size = 0

const self = this
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -350,0 +342,0 @@ /** @type {string} */

@@ -10,3 +10,2 @@ export {gfmFootnote} from './lib/syntax.js'

declare module 'micromark-util-types' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface TokenTypeMap {

@@ -26,3 +25,6 @@ gfmFootnoteCall: 'gfmFootnoteCall'

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface ParseContext {
gfmFootnotes?: string[]
}
interface CompileData {

@@ -29,0 +31,0 @@ gfmFootnoteDefinitions?: Record<string, string>

@@ -20,4 +20,4 @@ /**

*
* @param {Options | null | undefined} [options]
* Configuration.
* @param {Options | null | undefined} [options={}]
* Configuration (optional).
* @returns {HtmlExtension}

@@ -62,5 +62,4 @@ * Extension for `micromark` that can be passed in `htmlExtensions` to

* Prefix to use before the `id` attribute on footnotes to prevent them from
* *clobbering*.
* *clobbering* (default: `'user-content-'`).
*
* The default is `'user-content-'`.
* Pass `''` for trusted markdown and when you are careful with

@@ -84,7 +83,6 @@ * polyfilling.

*/
clobberPrefix?: string
clobberPrefix?: string | null | undefined
/**
* Textual label to use for the footnotes section.
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* The default value is `'Footnotes'`.
* Change it when the markdown is not in English.

@@ -97,5 +95,5 @@ *

*/
label?: string
label?: string | null | undefined
/**
* Attributes to use on the footnote label.
* Attributes to use on the footnote label (default: `'class="sr-only"'`).
*

@@ -113,5 +111,5 @@ * Change it to show the label and add other attributes.

*/
labelAttributes?: string
labelAttributes?: string | null | undefined
/**
* HTML tag name to use for the footnote label element.
* HTML tag name to use for the footnote label element (default: `'h2'`).
*

@@ -125,5 +123,6 @@ * Change it to match your document structure.

*/
labelTagName?: string
labelTagName?: string | null | undefined
/**
* Textual label to describe the backreference back to references.
* Textual label to describe the backreference back to references (default:
* `defaultBackLabel`).
*

@@ -148,3 +147,3 @@ * The default value is:

*/
backLabel?: BackLabelTemplate | string
backLabel?: BackLabelTemplate | string | null | undefined
}

@@ -38,7 +38,6 @@ /**

* Configuration.
* @property {string} [clobberPrefix='user-content-']
* @property {string | null | undefined} [clobberPrefix='user-content-']
* Prefix to use before the `id` attribute on footnotes to prevent them from
* *clobbering*.
* *clobbering* (default: `'user-content-'`).
*
* The default is `'user-content-'`.
* Pass `''` for trusted markdown and when you are careful with

@@ -61,6 +60,5 @@ * polyfilling.

* Using a prefix solves these problems.
* @property {string} [label='Footnotes']
* Textual label to use for the footnotes section.
* @property {string | null | undefined} [label='Footnotes']
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* The default value is `'Footnotes'`.
* Change it when the markdown is not in English.

@@ -72,4 +70,4 @@ *

* pass different attributes with the `labelAttributes` option.
* @property {string} [labelAttributes='class="sr-only"']
* Attributes to use on the footnote label.
* @property {string | null | undefined} [labelAttributes='class="sr-only"']
* Attributes to use on the footnote label (default: `'class="sr-only"'`).
*

@@ -86,4 +84,4 @@ * Change it to show the label and add other attributes.

* > calls use it with `aria-describedby` to provide an accessible label.
* @property {string} [labelTagName='h2']
* HTML tag name to use for the footnote label element.
* @property {string | null | undefined} [labelTagName='h2']
* HTML tag name to use for the footnote label element (default: `'h2'`).
*

@@ -96,4 +94,5 @@ * Change it to match your document structure.

* pass different attributes with the `labelAttributes` option.
* @property {BackLabelTemplate | string} [backLabel]
* Textual label to describe the backreference back to references.
* @property {BackLabelTemplate | string | null | undefined} [backLabel]
* Textual label to describe the backreference back to references (default:
* `defaultBackLabel`).
*

@@ -149,4 +148,4 @@ * The default value is:

*
* @param {Options | null | undefined} [options]
* Configuration.
* @param {Options | null | undefined} [options={}]
* Configuration (optional).
* @returns {HtmlExtension}

@@ -200,5 +199,3 @@ * Extension for `micromark` that can be passed in `htmlExtensions` to

gfmFootnoteDefinitionLabelString(token) {
let footnoteStack =
/** @type {Array<string>} */
this.getData('gfmFootnoteDefinitionStack')
let footnoteStack = this.getData('gfmFootnoteDefinitionStack')
if (!footnoteStack) {

@@ -248,11 +245,5 @@ this.setData('gfmFootnoteDefinitionStack', (footnoteStack = []))

null() {
const calls =
/** @type {Array<string>} */
this.getData('gfmFootnoteCallOrder') || []
const counts =
/** @type {Record<string, number>} */
this.getData('gfmFootnoteCallCounts') || {}
const definitions =
/** @type {Record<string, string>} */
this.getData('gfmFootnoteDefinitions') || {}
const calls = this.getData('gfmFootnoteCallOrder') || []
const counts = this.getData('gfmFootnoteCallCounts') || {}
const definitions = this.getData('gfmFootnoteDefinitions') || {}
let index = -1

@@ -306,9 +297,6 @@ if (calls.length > 0) {

this.tag(
definitions[id].replace(
/<\/p>(?:\r?\n|\r)?$/,
(/** @type {string} */ $0) => {
injected = true
return ' ' + reference + $0
}
)
definitions[id].replace(/<\/p>(?:\r?\n|\r)?$/, function ($0) {
injected = true
return ' ' + reference + $0
})
)

@@ -315,0 +303,0 @@ if (!injected) {

@@ -67,4 +67,2 @@ /**

let index = self.events.length
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -203,4 +201,2 @@ /** @type {Token} */

const self = this
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -326,4 +322,2 @@ let size = 0

const self = this
/** @type {Array<string>} */
// @ts-expect-error It’s fine!
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])

@@ -330,0 +324,0 @@ /** @type {string} */

{
"name": "micromark-extension-gfm-footnote",
"version": "1.1.2",
"version": "2.0.0",
"description": "micromark extension to support GFM footnotes",

@@ -28,4 +28,2 @@ "license": "MIT",

"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [

@@ -42,17 +40,17 @@ "dev/",

"dependencies": {
"micromark-core-commonmark": "^1.0.0",
"micromark-factory-space": "^1.0.0",
"micromark-util-character": "^1.0.0",
"micromark-util-normalize-identifier": "^1.0.0",
"micromark-util-sanitize-uri": "^1.0.0",
"micromark-util-symbol": "^1.0.0",
"micromark-util-types": "^1.0.0",
"uvu": "^0.5.0"
"devlop": "^1.0.0",
"micromark-core-commonmark": "^2.0.0",
"micromark-factory-space": "^2.0.0",
"micromark-util-character": "^2.0.0",
"micromark-util-normalize-identifier": "^2.0.0",
"micromark-util-sanitize-uri": "^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",

@@ -76,13 +74,23 @@ "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",
"unicorn/no-this-assignment": "off"

@@ -93,2 +101,10 @@ },

"files": [
"**/*.ts"
],
"rules": {
"@typescript-eslint/consistent-type-definitions": 0
}
},
{
"files": [
"test/**/*.js"

@@ -101,14 +117,3 @@ ],

]
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

@@ -71,3 +71,3 @@ # micromark-extension-gfm-footnote

This package is [ESM only][esm].
In Node.js (version 14.14+), install with [npm][]:
In Node.js (version 16+), install with [npm][]:

@@ -81,3 +81,3 @@ ```sh

```js
import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@1'
import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@2'
```

@@ -89,3 +89,3 @@

<script type="module">
import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@1?bundle'
import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@2?bundle'
</script>

@@ -474,7 +474,2 @@ ```

<!--
To do: update link when `string` is documented on its own.
Also, add links to character escape/reference constructs.
-->
The identifiers in the `label` parts are interpreted as the

@@ -523,9 +518,12 @@ [string][micromark-content-types] content type.

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-footnote@^2`, compatible with Node.js 16.
This package works with `micromark` version `3` and later.
## Security

@@ -577,5 +575,5 @@

[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-gfm-footnote.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-footnote
[size]: https://bundlephobia.com/result?p=micromark-extension-gfm-footnote
[size]: https://bundlejs.com/?q=micromark-extension-gfm-footnote

@@ -600,7 +598,7 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg

[contributing]: https://github.com/micromark/.github/blob/HEAD/contributing.md
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
[support]: https://github.com/micromark/.github/blob/HEAD/support.md
[support]: https://github.com/micromark/.github/blob/main/support.md
[coc]: https://github.com/micromark/.github/blob/HEAD/code-of-conduct.md
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md

@@ -607,0 +605,0 @@ [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc