• Version 9.0.1
  • Published
  • 155 kB
  • No dependencies
  • Unlicense license


npm i markdown-it-anchor
yarn add markdown-it-anchor
pnpm add markdown-it-anchor


Header anchors for markdown-it.



function anchor

anchor: typeof anchor;


    namespace anchor

    namespace anchor {}
      const permalink: {
      headerLink: (opts?: HeaderLinkPermalinkOptions) => PermalinkGenerator;
      linkAfterHeader: (opts?: LinkAfterHeaderPermalinkOptions) => PermalinkGenerator;
      linkInsideHeader: (
      opts?: LinkInsideHeaderPermalinkOptions
      ) => PermalinkGenerator;
      ariaHidden: (opts?: AriaHiddenPermalinkOptions) => PermalinkGenerator;

        interface AnchorInfo

        interface AnchorInfo {}

          property slug

          slug: string;

            property title

            title: string;

              interface AnchorOptions

              interface AnchorOptions {}

                property level

                level?: number | number[];
                  permalink?: PermalinkGenerator;

                    property tabIndex

                    tabIndex?: number | false;

                      property uniqueSlugStartIndex

                      uniqueSlugStartIndex?: number;

                        method callback

                        callback: (token: Token, anchor_info: AnchorInfo) => void;

                          method getTokensText

                          getTokensText: (tokens: Token[]) => string;

                            method slugify

                            slugify: (str: string) => string;

                              interface AriaHiddenPermalinkOptions

                              interface AriaHiddenPermalinkOptions extends PermalinkOptions {}

                                property placement

                                placement?: 'before' | 'after';

                                  property space

                                  space?: boolean | string;

                                    interface HeaderLinkPermalinkOptions

                                    interface HeaderLinkPermalinkOptions extends PermalinkOptions {}

                                      property safariReaderFix

                                      safariReaderFix?: boolean;

                                        interface LinkAfterHeaderPermalinkOptions

                                        interface LinkAfterHeaderPermalinkOptions extends PermalinkOptions {}

                                          property assistiveText

                                          assistiveText?: (title: string) => string;

                                            property placement

                                            placement?: 'before' | 'after';

                                              property space

                                              space?: boolean | string;

                                                property style

                                                | 'visually-hidden'
                                                | 'aria-label'
                                                | 'aria-describedby'
                                                | 'aria-labelledby';

                                                  property visuallyHiddenClass

                                                  visuallyHiddenClass?: string;

                                                    property wrapper

                                                    wrapper?: [string, string] | null;

                                                      interface LinkInsideHeaderPermalinkOptions

                                                      interface LinkInsideHeaderPermalinkOptions extends PermalinkOptions {}

                                                        property ariaHidden

                                                        ariaHidden?: boolean;

                                                          property placement

                                                          placement?: 'before' | 'after';

                                                            property space

                                                            space?: boolean | string;

                                                              interface PermalinkOptions

                                                              interface PermalinkOptions {}

                                                                property class

                                                                class?: string;

                                                                  property renderAttrs

                                                                  renderAttrs?: RenderAttrs;

                                                                    property renderHref

                                                                    renderHref?: RenderHref;

                                                                      property symbol

                                                                      symbol?: string;

                                                                        type PermalinkGenerator

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

                                                                          type RenderAttrs

                                                                          type RenderAttrs = (slug: string, state: State) => Record<string, string | number>;

                                                                            type RenderHref

                                                                            type RenderHref = (slug: string, state: State) => string;

                                                                              Package Files (1)

                                                                              Dependencies (0)

                                                                              No dependencies.

                                                                              Dev Dependencies (6)

                                                                              Peer Dependencies (2)


                                                                              To add a badge like this badgeto your package's README, use the codes available below.

                                                                              You may also use to create a custom badge linking to

                                                                              • Markdown
                                                                              • HTML
                                                                                <a href=""><img src="" alt=""></a>