UNPKG

vitepress-plugin-sidebar-permalink

Version:
52 lines (47 loc) 1.83 kB
import { Plugin } from 'vitepress'; import { S as SidebarPermalinkOptions } from './shared/vitepress-plugin-sidebar-permalink.CMIevfU-.js'; export { F as Frontmatter, R as RewritesJson, a as SidebarItem } from './shared/vitepress-plugin-sidebar-permalink.CMIevfU-.js'; import * as vite from 'vite'; /** * 从 md 文件中读取一级标题 * @param markdownContent md 文件内容 */ declare const getTitleFromMd: (mdContent: string) => string | undefined; /** * 判断是否非法的序号 * * @param index 序号 */ declare const isIllegalIndex: (index: number) => boolean; /** * 判断数组中是否存在某个元素,支持正则表达式 * * @param arr 数组 * @param name 元素 */ declare const isSome: (arr: Array<string | RegExp>, name: string) => boolean; /** * 判断链接是否为外部链接 * @param link 链接 * @returns 如果是外部链接返回 true,否则返回 false * @description 外部链接的定义: * 1. 以 http:// 或 https:// 开头的链接 * 2. 以 mailto: 或 tel: 开头的链接 * 3. 不以 /pages 或 / 开头的链接 * 4. 如果链接为空,则视为外部链接 */ declare function isExternalLink(link?: string): boolean; /** * * @param dir 目录路径 * @description 获取指定目录下所有的 md 文件路径 * @param baseDir 基础目录,用于计算相对路径 * @param ignoreDirs 忽略目录 * @returns 返回所有 md 文件的相对路径数组 */ declare function getAllMdFiles(dir: string, baseDir?: string, ignoreDirs?: string[]): string[]; declare const logger: vite.Logger; declare function SidebarPermalinkPlugin(options?: SidebarPermalinkOptions): Plugin; // @ts-ignore export default SidebarPermalinkPlugin; export { SidebarPermalinkOptions, getAllMdFiles, getTitleFromMd, isExternalLink, isIllegalIndex, isSome, logger };