Skip to content

Commit

Permalink
Merge pull request #135 from nex3/patch-1
Browse files Browse the repository at this point in the history
Export Token and State types from index.d.ts
  • Loading branch information
valeriangalliat authored Sep 7, 2024
2 parents b10a72e + 1628108 commit 75e6322
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import MarkdownIt from 'markdown-it';
import Token from 'markdown-it/lib/token.mjs';
import State from 'markdown-it/lib/rules_core/state_core.mjs';
import MarkdownIt, {StateCore, Token} from 'markdown-it';

declare namespace anchor {
export type RenderHref = (slug: string, state: State) => string;
export type RenderAttrs = (slug: string, state: State) => Record<string, string | number>;
export type RenderHref = (slug: string, state: StateCore) => string;
export type RenderAttrs = (slug: string, state: StateCore) => Record<string, string | number>;

export interface PermalinkOptions {
class?: string,
Expand Down Expand Up @@ -37,7 +35,7 @@ declare namespace anchor {
placement?: 'before' | 'after'
}

export type PermalinkGenerator = (slug: string, opts: PermalinkOptions, state: State, index: number) => void;
export type PermalinkGenerator = (slug: string, opts: PermalinkOptions, state: StateCore, index: number) => void;

export interface AnchorInfo {
slug: string;
Expand All @@ -48,7 +46,7 @@ declare namespace anchor {
level?: number | number[];

slugify?(str: string): string;
slugifyWithState?(str: string, state: State): string;
slugifyWithStateCore?(str: string, state: StateCore): string;
getTokensText?(tokens: Token[]): string;

uniqueSlugStartIndex?: number;
Expand Down

0 comments on commit 75e6322

Please sign in to comment.