Skip to content

Commit

Permalink
Change to rename Directive -> Directives
Browse files Browse the repository at this point in the history
This is more in line with the new enums of nodes now in mdast, such as `Nodes`
for all node types, and `Parents` for all parents.
  • Loading branch information
wooorm committed Jul 11, 2023
1 parent f163eb0 commit 5eddaa3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface TextDirective extends Parent, DirectiveFields {
/**
* The different directive nodes.
*/
export type Directive = ContainerDirective | LeafDirective | TextDirective
export type Directives = ContainerDirective | LeafDirective | TextDirective

// Add custom data tracked to turn markdown into a tree.
declare module 'mdast-util-from-markdown' {
Expand Down
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
* @typedef {import('mdast-util-to-markdown').State} State
*
* @typedef {import('../index.js').Directive} Directive
* @typedef {import('../index.js').Directives} Directives
* @typedef {import('../index.js').LeafDirective} LeafDirective
* @typedef {import('../index.js').TextDirective} TextDirective
*/
Expand Down Expand Up @@ -132,7 +132,7 @@ function enterText(token) {

/**
* @this {CompileContext}
* @param {Directive['type']} type
* @param {Directives['type']} type
* @param {Token} token
*/
function enter(type, token) {
Expand Down Expand Up @@ -278,7 +278,7 @@ function exit(token) {

/**
* @type {ToMarkdownHandle}
* @param {Directive} node
* @param {Directives} node
*/
function handleDirective(node, _, state, info) {
const tracker = state.createTracker(info)
Expand Down Expand Up @@ -345,7 +345,7 @@ function peekDirective() {
}

/**
* @param {Directive} node
* @param {Directives} node
* @param {State} state
* @returns {string}
*/
Expand Down Expand Up @@ -439,7 +439,7 @@ function inlineDirectiveLabel(node) {
}

/**
* @param {Directive} node
* @param {Directives} node
* @returns {string}
*/
function fence(node) {
Expand Down
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ such).
* [`directiveFromMarkdown`](#directivefrommarkdown)
* [`directiveToMarkdown`](#directivetomarkdown)
* [`ContainerDirective`](#containerdirective)
* [`Directive`](#directive)
* [`Directives`](#directives)
* [`LeafDirective`](#leafdirective)
* [`TextDirective`](#textdirective)
* [HTML](#html)
Expand Down Expand Up @@ -198,14 +198,14 @@ interface ContainerDirective extends Parent {
}
```

### `Directive`
### `Directives`

The different directive nodes (TypeScript type).

###### Type

```ts
type Directive = ContainerDirective | LeafDirective | TextDirective
type Directives = ContainerDirective | LeafDirective | TextDirective
```
### `LeafDirective`
Expand Down Expand Up @@ -410,7 +410,7 @@ or hast).

This package is fully typed with [TypeScript][].
It exports the additional types [`ContainerDirective`][api-container-directive],
[`Directive`][api-directive], [`LeafDirective`][api-leaf-directive], and
[`Directives`][api-directives], [`LeafDirective`][api-leaf-directive], and
[`TextDirective`][api-text-directive].

It also registers the node types with `@types/mdast`.
Expand Down Expand Up @@ -552,10 +552,10 @@ abide by its terms.

[api-container-directive]: #containerdirective

[api-directive]: #directive
[api-directives]: #directives

[api-leaf-directive]: #leafdirective

[api-text-directive]: #textdirective

[dfn-mxn-directive]: #directive-1
[dfn-mxn-directive]: #directive

0 comments on commit 5eddaa3

Please sign in to comment.