declare module 'markdown-it' {
  interface Token {
    type: string
    tag: string
    attrs: Array<[string, string]>
    map: [number, number] | null
    nesting: number
    level: number
    children: Token[] | null
    content: string
    markup: string
    info: string
    meta: any
    block: boolean
    hidden: boolean
  }

  interface Renderer {
    rules: Record<string, (tokens: Token[], idx: number, options: any, env: any, self: Renderer) => string>
  }

  interface MarkdownIt {
    renderer: Renderer
    render: (src: string, env?: any) => string
    parse: (src: string, env?: any) => Token[]
  }

  interface Options {
    html?: boolean
    xhtmlOut?: boolean
    breaks?: boolean
    langPrefix?: string
    linkify?: boolean
    typographer?: boolean
    quotes?: string
    highlight?: (str: string, lang: string) => string
  }

  interface MarkdownItConstructor {
    new (options?: Options): MarkdownIt
    (options?: Options): MarkdownIt
  }

  const MarkdownIt: MarkdownItConstructor
  export default MarkdownIt
  export { MarkdownIt, Options, Renderer, Token }
}
