Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

micromark-extension-directive

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-directive - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

2

dev/index.d.ts

@@ -12,3 +12,2 @@ import type {Attribute, Directive} from './lib/html.js'

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

@@ -78,3 +77,2 @@ directiveContainer: 'directiveContainer'

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface CompileData {

@@ -81,0 +79,0 @@ directiveAttributes?: Attribute[]

6

dev/lib/directive-container.js

@@ -9,8 +9,6 @@ /**

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEnding} from 'micromark-util-character'
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'
import {factoryAttributes} from './factory-attributes.js'

@@ -17,0 +15,0 @@ import {factoryLabel} from './factory-label.js'

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

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEnding} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol/codes.js'
import {types} from 'micromark-util-symbol/types.js'
import {codes, types} from 'micromark-util-symbol'
import {factoryAttributes} from './factory-attributes.js'

@@ -15,0 +14,0 @@ import {factoryLabel} from './factory-label.js'

@@ -9,5 +9,4 @@ /**

import {ok as assert} from 'uvu/assert'
import {codes} from 'micromark-util-symbol/codes.js'
import {types} from 'micromark-util-symbol/types.js'
import {ok as assert} from 'devlop'
import {codes, types} from 'micromark-util-symbol'
import {factoryAttributes} from './factory-attributes.js'

@@ -14,0 +13,0 @@ import {factoryLabel} from './factory-label.js'

@@ -16,3 +16,3 @@ /**

* @param {TokenType} attributeValueData
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/

@@ -37,3 +37,3 @@ export function factoryAttributes(

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Code = import('micromark-util-types').Code

@@ -40,0 +40,0 @@ export type Effects = import('micromark-util-types').Effects

@@ -8,3 +8,3 @@ /**

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {factorySpace} from 'micromark-factory-space'

@@ -19,4 +19,3 @@ import {factoryWhitespace} from 'micromark-factory-whitespace'

} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol/codes.js'
import {types} from 'micromark-util-symbol/types.js'
import {codes, types} from 'micromark-util-symbol'

@@ -38,5 +37,4 @@ /**

* @param {TokenType} attributeValueData
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/
/* eslint-disable-next-line max-params */
export function factoryAttributes(

@@ -43,0 +41,0 @@ effects,

@@ -8,3 +8,3 @@ /**

* @param {TokenType} stringType
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/

@@ -21,3 +21,3 @@ export function factoryLabel(

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Effects = import('micromark-util-types').Effects

@@ -24,0 +24,0 @@ export type State = import('micromark-util-types').State

@@ -8,7 +8,5 @@ /**

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {markdownLineEnding} from 'micromark-util-character'
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'

@@ -27,5 +25,4 @@ // This is a fork of:

* @param {TokenType} stringType
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/
// eslint-disable-next-line max-params
export function factoryLabel(

@@ -42,3 +39,3 @@ effects,

let balance = 0
/** @type {Token|undefined} */
/** @type {Token | undefined} */
let previous

@@ -45,0 +42,0 @@

@@ -16,3 +16,3 @@ /**

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Effects = import('micromark-util-types').Effects

@@ -19,0 +19,0 @@ export type State = import('micromark-util-types').State

@@ -9,3 +9,3 @@ /**

import {asciiAlpha, asciiAlphanumeric} from 'micromark-util-character'
import {codes} from 'micromark-util-symbol/codes.js'
import {codes} from 'micromark-util-symbol'

@@ -12,0 +12,0 @@ /**

@@ -5,4 +5,4 @@ /**

*
* @param {HtmlOptions | null | undefined} [options]
* Configuration.
* @param {HtmlOptions | null | undefined} [options={}]
* Configuration (default: `{}`).
* @returns {HtmlExtension}

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

directive: Directive
) => boolean | void
) => boolean | undefined
/**

@@ -38,0 +38,0 @@ * Structure representing a directive.

@@ -25,4 +25,5 @@ /**

* Directive.
* @returns {boolean | void}
* @returns {boolean | undefined}
* Signal whether the directive was handled.
*
* Yield `false` to let the fallback (a special handle for `'*'`) handle it.

@@ -49,3 +50,3 @@ *

import {ok as assert} from 'uvu/assert'
import {ok as assert} from 'devlop'
import {parseEntities} from 'parse-entities'

@@ -59,4 +60,4 @@

*
* @param {HtmlOptions | null | undefined} [options]
* Configuration.
* @param {HtmlOptions | null | undefined} [options={}]
* Configuration (default: `{}`).
* @returns {HtmlExtension}

@@ -71,3 +72,3 @@ * Extension for `micromark` that can be passed in `htmlExtensions`, to

directiveContainer() {
return enter.call(this, 'containerDirective')
enter.call(this, 'containerDirective')
},

@@ -81,3 +82,3 @@ directiveContainerAttributes: enterAttributes,

directiveLeaf() {
return enter.call(this, 'leafDirective')
enter.call(this, 'leafDirective')
},

@@ -88,3 +89,3 @@ directiveLeafAttributes: enterAttributes,

directiveText() {
return enter.call(this, 'textDirective')
enter.call(this, 'textDirective')
},

@@ -292,5 +293,5 @@ directiveTextAttributes: enterAttributes,

assert(directive, 'expected directive')
/** @type {boolean|undefined} */
/** @type {boolean | undefined} */
let found
/** @type {boolean|void} */
/** @type {boolean | undefined} */
let result

@@ -297,0 +298,0 @@

@@ -5,3 +5,3 @@ /**

import {codes} from 'micromark-util-symbol/codes.js'
import {codes} from 'micromark-util-symbol'
import {directiveContainer} from './directive-container.js'

@@ -8,0 +8,0 @@ import {directiveLeaf} from './directive-leaf.js'

@@ -12,3 +12,2 @@ import type {Attribute, Directive} from './lib/html.js'

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

@@ -78,3 +77,2 @@ directiveContainer: 'directiveContainer'

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface CompileData {

@@ -81,0 +79,0 @@ directiveAttributes?: Attribute[]

@@ -16,3 +16,3 @@ /**

* @param {TokenType} attributeValueData
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/

@@ -37,3 +37,3 @@ export function factoryAttributes(

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Code = import('micromark-util-types').Code

@@ -40,0 +40,0 @@ export type Effects = import('micromark-util-types').Effects

@@ -32,5 +32,4 @@ /**

* @param {TokenType} attributeValueData
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/
/* eslint-disable-next-line max-params */
export function factoryAttributes(

@@ -37,0 +36,0 @@ effects,

@@ -8,3 +8,3 @@ /**

* @param {TokenType} stringType
* @param {boolean} [disallowEol=false]
* @param {boolean | undefined} [disallowEol=false]
*/

@@ -21,3 +21,3 @@ export function factoryLabel(

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Effects = import('micromark-util-types').Effects

@@ -24,0 +24,0 @@ export type State = import('micromark-util-types').State

@@ -13,3 +13,2 @@ /**

// text instead of strings, and optionally disallows EOLs.
/**

@@ -22,4 +21,4 @@ * @param {Effects} effects

* @param {TokenType} stringType
* @param {boolean} [disallowEol=false]
*/ // eslint-disable-next-line max-params
* @param {boolean | undefined} [disallowEol=false]
*/
export function factoryLabel(

@@ -36,3 +35,3 @@ effects,

let balance = 0
/** @type {Token|undefined} */
/** @type {Token | undefined} */
let previous

@@ -39,0 +38,0 @@ return start

@@ -16,3 +16,3 @@ /**

code: import('micromark-util-types').Code
) => void | import('micromark-util-types').State
) => import('micromark-util-types').State | undefined
export type Effects = import('micromark-util-types').Effects

@@ -19,0 +19,0 @@ export type State = import('micromark-util-types').State

@@ -5,4 +5,4 @@ /**

*
* @param {HtmlOptions | null | undefined} [options]
* Configuration.
* @param {HtmlOptions | null | undefined} [options={}]
* Configuration (default: `{}`).
* @returns {HtmlExtension}

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

directive: Directive
) => boolean | void
) => boolean | undefined
/**

@@ -38,0 +38,0 @@ * Structure representing a directive.

@@ -25,4 +25,5 @@ /**

* Directive.
* @returns {boolean | void}
* @returns {boolean | undefined}
* Signal whether the directive was handled.
*
* Yield `false` to let the fallback (a special handle for `'*'`) handle it.

@@ -56,4 +57,4 @@ *

*
* @param {HtmlOptions | null | undefined} [options]
* Configuration.
* @param {HtmlOptions | null | undefined} [options={}]
* Configuration (default: `{}`).
* @returns {HtmlExtension}

@@ -68,3 +69,3 @@ * Extension for `micromark` that can be passed in `htmlExtensions`, to

directiveContainer() {
return enter.call(this, 'containerDirective')
enter.call(this, 'containerDirective')
},

@@ -77,3 +78,3 @@ directiveContainerAttributes: enterAttributes,

directiveLeaf() {
return enter.call(this, 'leafDirective')
enter.call(this, 'leafDirective')
},

@@ -83,3 +84,3 @@ directiveLeafAttributes: enterAttributes,

directiveText() {
return enter.call(this, 'textDirective')
enter.call(this, 'textDirective')
},

@@ -273,5 +274,5 @@ directiveTextAttributes: enterAttributes,

const directive = stack.pop()
/** @type {boolean|undefined} */
/** @type {boolean | undefined} */
let found
/** @type {boolean|void} */
/** @type {boolean | undefined} */
let result

@@ -278,0 +279,0 @@ if (own.call(options_, directive.name)) {

{
"name": "micromark-extension-directive",
"version": "2.2.1",
"version": "3.0.0",
"description": "micromark extension to support generic directives (`:cite[smith04]`)",

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

"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": {
"development": "./dev/index.js",
"default": "./index.js"
},
"files": [

@@ -37,22 +39,17 @@ "dev/",

],
"exports": {
"types": "./index.d.ts",
"development": "./dev/index.js",
"default": "./index.js"
},
"dependencies": {
"micromark-factory-space": "^1.0.0",
"micromark-factory-whitespace": "^1.0.0",
"micromark-util-character": "^1.0.0",
"micromark-util-symbol": "^1.0.0",
"micromark-util-types": "^1.0.0",
"parse-entities": "^4.0.0",
"uvu": "^0.5.0"
"devlop": "^1.0.0",
"micromark-factory-space": "^2.0.0",
"micromark-factory-whitespace": "^2.0.0",
"micromark-util-character": "^2.0.0",
"micromark-util-symbol": "^2.0.0",
"micromark-util-types": "^2.0.0",
"parse-entities": "^4.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"c8": "^7.0.0",
"html-void-elements": "^2.0.0",
"micromark": "^3.0.0",
"micromark-build": "^1.0.0",
"c8": "^8.0.0",
"html-void-elements": "^3.0.0",
"micromark": "^4.0.0",
"micromark-build": "^2.0.0",
"prettier": "^2.0.0",

@@ -76,20 +73,12 @@ "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
},
"xo": {
"prettier": true,
"rules": {
"n/file-extension-in-import": "off",
"unicorn/no-this-assignment": "off",
"unicorn/prefer-node-protocol": "off"
}
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
"remark-preset-wooorm"
]

@@ -100,5 +89,22 @@ },

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

@@ -60,3 +60,3 @@ # micromark-extension-directive

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

@@ -72,3 +72,3 @@ [npm][]:

```js
import {directive, directiveHtml} from 'https://esm.sh/micromark-extension-directive@2'
import {directive, directiveHtml} from 'https://esm.sh/micromark-extension-directive@3'
```

@@ -80,3 +80,3 @@

<script type="module">
import {directive, directiveHtml} from 'https://esm.sh/micromark-extension-directive@2?bundle'
import {directive, directiveHtml} from 'https://esm.sh/micromark-extension-directive@3?bundle'
</script>

@@ -110,2 +110,3 @@ ```

* @type {import('micromark-extension-directive').Handle}
* @returns {undefined}
*/

@@ -161,3 +162,3 @@ function abbr(d) {

* `options` ([`HtmlOptions`][api-html-options], optional)
* `options` ([`HtmlOptions`][api-html-options], default: `{}`)
— configuration

@@ -177,11 +178,11 @@

* `type` (`'textDirective'`, `'leafDirective'`, or `'containerDirective'`)
* `type` (`'containerDirective'`, `'leafDirective'`, or `'textDirective'`)
— kind
* `name` (`string`)
— name of directive
* `label` (`string`, optional)
* `label` (`string` or `undefined`)
— compiled HTML content that was in `[brackets]`
* `attributes` (`Record<string, string>`, optional)
* `attributes` (`Record<string, string>` or `undefined`)
— object w/ HTML attributes
* `content` (`string`, optional)
* `content` (`string` or `undefined`)
— compiled HTML content inside container directive

@@ -315,9 +316,12 @@

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

@@ -364,5 +368,5 @@

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

@@ -387,7 +391,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

@@ -394,0 +398,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