Socket
Socket
Sign inDemoInstall

mdast-util-gfm-footnote

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-gfm-footnote - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

1

index.d.ts
export {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from './lib/index.js'
declare module 'mdast-util-to-markdown' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface ConstructNameMap {

@@ -6,0 +5,0 @@ /**

4

lib/index.d.ts

@@ -17,9 +17,9 @@ /**

export function gfmFootnoteToMarkdown(): ToMarkdownExtension
export type FootnoteDefinition = import('mdast').FootnoteDefinition
export type FootnoteReference = import('mdast').FootnoteReference
export type FootnoteDefinition = import('mdast').FootnoteDefinition
export type CompileContext = import('mdast-util-from-markdown').CompileContext
export type FromMarkdownExtension = import('mdast-util-from-markdown').Extension
export type FromMarkdownHandle = import('mdast-util-from-markdown').Handle
export type ToMarkdownExtension = import('mdast-util-to-markdown').Options
export type ToMarkdownHandle = import('mdast-util-to-markdown').Handle
export type Map = import('mdast-util-to-markdown').Map
export type ToMarkdownExtension = import('mdast-util-to-markdown').Options
/**
* @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition
* @typedef {import('mdast').FootnoteReference} FootnoteReference
* @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
* @typedef {import('mdast-util-to-markdown').Map} Map
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
*/
import {ok as assert} from 'devlop'
import {normalizeIdentifier} from 'micromark-util-normalize-identifier'
import {association} from 'mdast-util-to-markdown/lib/util/association.js'
import {containerFlow} from 'mdast-util-to-markdown/lib/util/container-flow.js'
import {indentLines} from 'mdast-util-to-markdown/lib/util/indent-lines.js'
import {safe} from 'mdast-util-to-markdown/lib/util/safe.js'
import {track} from 'mdast-util-to-markdown/lib/util/track.js'
footnoteReference.peek = footnoteReferencePeek
// To do: next major: rename `context` -> `state`, `safeOptions` to `info`, use
// utilities on `state`.
/**

@@ -88,5 +81,4 @@ * Create an extension for `mdast-util-from-markdown` to enable GFM footnotes

const label = this.resume()
const node = /** @type {FootnoteDefinition} */ (
this.stack[this.stack.length - 1]
)
const node = this.stack[this.stack.length - 1]
assert(node.type === 'footnoteDefinition')
node.label = label

@@ -128,5 +120,4 @@ node.identifier = normalizeIdentifier(

const label = this.resume()
const node = /** @type {FootnoteDefinition} */ (
this.stack[this.stack.length - 1]
)
const node = this.stack[this.stack.length - 1]
assert(node.type === 'footnoteReference')
node.label = label

@@ -150,9 +141,9 @@ node.identifier = normalizeIdentifier(

*/
function footnoteReference(node, _, context, safeOptions) {
const tracker = track(safeOptions)
function footnoteReference(node, _, state, info) {
const tracker = state.createTracker(info)
let value = tracker.move('[^')
const exit = context.enter('footnoteReference')
const subexit = context.enter('reference')
const exit = state.enter('footnoteReference')
const subexit = state.enter('reference')
value += tracker.move(
safe(context, association(node), {
state.safe(state.associationId(node), {
...tracker.current(),

@@ -178,9 +169,9 @@ before: value,

*/
function footnoteDefinition(node, _, context, safeOptions) {
const tracker = track(safeOptions)
function footnoteDefinition(node, _, state, info) {
const tracker = state.createTracker(info)
let value = tracker.move('[^')
const exit = context.enter('footnoteDefinition')
const subexit = context.enter('label')
const exit = state.enter('footnoteDefinition')
const subexit = state.enter('label')
value += tracker.move(
safe(context, association(node), {
state.safe(state.associationId(node), {
...tracker.current(),

@@ -197,3 +188,3 @@ before: value,

value += tracker.move(
indentLines(containerFlow(node, context, tracker.current()), map)
state.indentLines(state.containerFlow(node, tracker.current()), map)
)

@@ -200,0 +191,0 @@ exit()

{
"name": "mdast-util-gfm-footnote",
"version": "1.0.2",
"version": "2.0.0",
"description": "mdast extension to parse and serialize GFM footnotes",

@@ -30,4 +30,3 @@ "license": "MIT",

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

@@ -39,11 +38,12 @@ "lib/",

"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-util-to-markdown": "^1.3.0",
"micromark-util-normalize-identifier": "^1.0.0"
"@types/mdast": "^4.0.0",
"devlop": "^1.1.0",
"mdast-util-from-markdown": "^2.0.0",
"mdast-util-to-markdown": "^2.0.0",
"micromark-util-normalize-identifier": "^2.0.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"c8": "^7.0.0",
"mdast-util-from-markdown": "^1.0.0",
"micromark-extension-gfm-footnote": "^1.0.0",
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"micromark-extension-gfm-footnote": "^2.0.0",
"prettier": "^2.0.0",

@@ -53,4 +53,4 @@ "remark-cli": "^11.0.0",

"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.53.0"
"typescript": "^5.0.0",
"xo": "^0.54.0"
},

@@ -61,20 +61,19 @@ "scripts": {

"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
"test-api-dev": "node --conditions development test.js",
"test-api-prod": "node --conditions production test.js",
"test-api": "npm run test-api-dev && npm run test-api-prod",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"xo": {
"prettier": true
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
"remark-preset-wooorm"
]

@@ -85,5 +84,18 @@ },

"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"overrides": [
{
"files": [
"**/*.ts"
],
"rules": {
"@typescript-eslint/consistent-type-definitions": "off"
}
}
],
"prettier": true
}
}

@@ -72,3 +72,3 @@ # mdast-util-gfm-footnote

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

@@ -82,3 +82,3 @@ ```sh

```js
import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@1'
import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@2'
```

@@ -90,3 +90,3 @@

<script type="module">
import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@1?bundle'
import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@2?bundle'
</script>

@@ -196,3 +196,3 @@ ```

See [Syntax in `micromark-extension-frontmatter`][syntax].
See [Syntax in `micromark-extension-gfm-footnote`][syntax].

@@ -263,3 +263,3 @@ ## Syntax tree

**FootnoteReference** can be used where
**[static phrasing][dfn-static-phrasing-content]** content is expected.
**[phrasing][dfn-phrasing-content]** content is expected.
It has no content model.

@@ -296,6 +296,6 @@

#### `StaticPhrasingContent` (GFM footnotes)
#### `PhrasingContent` (GFM footnotes)
```idl
type StaticPhrasingContentGfm = FootnoteReference | StaticPhrasingContent
type PhrasingContentGfm = FootnoteReference | PhrasingContent
```

@@ -313,9 +313,9 @@

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+ and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
This plugin works with `mdast-util-from-markdown` version 1+ and
`mdast-util-to-markdown` version 1+.
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,
`mdast-util-gfm-footnote@^2`, compatible with Node.js 16.

@@ -360,5 +360,5 @@ ## Related

[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-gfm-footnote.svg
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-gfm-footnote
[size]: https://bundlephobia.com/result?p=mdast-util-gfm-footnote
[size]: https://bundlejs.com/?q=mdast-util-gfm-footnote

@@ -431,3 +431,3 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg

[dfn-static-phrasing-content]: #staticphrasingcontent-gfm-footnotes
[dfn-phrasing-content]: #phrasingcontent-gfm-footnotes

@@ -434,0 +434,0 @@ [dfn-footnote-reference]: #footnotereference

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