react-mdxutils
Version:
Utilities for MDX content, including anchor extraction.
21 lines (17 loc) • 612 B
TypeScript
import * as react from 'react';
type TocItem = {
content: string;
slug: string;
level: number;
};
declare const generateTocFromMdx: (mdxContent: string) => TocItem[];
declare const useActiveHeading: (content: string) => {
activeHeading: string;
handleActiveHeading: (btn: HTMLElement, hashLink?: string) => void;
headingListRefs: react.RefObject<{
[key: string]: HTMLElement | null;
}>;
activeIndicatorRef: react.RefObject<HTMLDivElement | null>;
asideRef: react.RefObject<HTMLUListElement | null>;
};
export { type TocItem, generateTocFromMdx, useActiveHeading };