Skip to content

Commit

Permalink
fix: fixed types (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m1d0v authored Nov 27, 2024
1 parent 8a56212 commit b1aa8d4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ export type LeafBlockDirectiveHandler = (
) => boolean;
export type InlineDirectiveHandler = (state: StateInline, params: InlineDirectiveParams) => boolean;

type TokensDesc = {
type TokensDesc<P> = {
tag: string;
token: string;
attrs?: DirectiveAttrs | ((params: LeafBlockDirectiveParams) => DirectiveAttrs);
attrs?: DirectiveAttrs | ((params: P) => DirectiveAttrs);
};

export type ContainerDirectiveConfig = {
name: string;
type?: 'container_block';
match: (params: ContainerDirectiveParams, state: StateBlock) => boolean;
container: TokensDesc;
inlineContent?: TokensDesc & {
container: TokensDesc<ContainerDirectiveParams>;
inlineContent?: TokensDesc<ContainerDirectiveParams> & {
/** @default true */
required?: boolean;
};
content?: TokensDesc;
content?: TokensDesc<ContainerDirectiveParams>;
/** If not passed – default tokenizer will be used */
contentTokenizer?: (
state: StateBlock,
Expand All @@ -83,7 +83,7 @@ export type CodeContainerDirectiveConfig = {
name: string;
type: 'code_block';
match: (params: ContainerDirectiveParams, state: StateBlock) => boolean;
container: TokensDesc;
container: TokensDesc<ContainerDirectiveParams>;
};

export interface MdItWithHandlers extends MarkdownIt {
Expand Down

0 comments on commit b1aa8d4

Please sign in to comment.