Skip to content

Commit

Permalink
Fix types to allow definitions in container directives
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 29, 2023
1 parent 849a112 commit 5dd31e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {BlockContent, PhrasingContent} from 'mdast'
import type {BlockContent, DefinitionContent, PhrasingContent} from 'mdast'

export {directiveFromMarkdown, directiveToMarkdown} from './lib/index.js'

Expand Down Expand Up @@ -29,7 +29,7 @@ export interface ContainerDirective extends Parent, DirectiveFields {
/**
* Content.
*/
children: BlockContent[]
children: Array<BlockContent | DefinitionContent>
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @typedef {import('mdast').BlockContent} BlockContent
* @typedef {import('mdast').DefinitionContent} DefinitionContent
* @typedef {import('mdast').Paragraph} Paragraph
*
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
Expand Down Expand Up @@ -416,7 +417,7 @@ function attributes(node, state) {
}

/**
* @param {BlockContent} node
* @param {BlockContent | DefinitionContent} node
* @returns {node is Paragraph & {data: {directiveLabel: boolean}}}
*/
function inlineDirectiveLabel(node) {
Expand Down

0 comments on commit 5dd31e7

Please sign in to comment.