vuepress-plugin-llms
Version:
📜 VuePress plugin for generating documentation friendly to Large Language Models (LLMs) | 📜 VuePress 插件,用于生成对大语言模型(LLMs)友好的文档。
51 lines (50 loc) • 2.54 kB
TypeScript
import type { GrayMatterFile } from 'gray-matter';
/**
* Extract the title from frontmatter or the first heading. | 从 frontmatter 或第一个标题中提取标题。
* @param file - The gray-matter file object | gray-matter 文件对象
* @returns The title as string or undefined if no title found | 标题字符串,如果未找到标题则返回 undefined
*/
export declare function extractTitle(file: GrayMatterFile<string>): string | undefined;
/**
* Format a file size to a human-readable form. | 将文件大小格式化为人类可读的形式。
* @param bytes - Number of bytes | 字节数
* @param decimals - Number of decimals to display | 要显示的小数位数
* @returns Formatted size string (e.g., "2.5 KB") | 格式化的大小字符串(例如,"2.5 KB")
*/
export declare function getHumanReadableSizeOf(bytes: number, decimals?: number): string;
/**
* Expand template placeholders with provided variables. | 使用提供的变量展开模板占位符。
* @param template - Template string with placeholders in {variable} format | 带有 {variable} 格式占位符的模板字符串
* @param variables - Object with values to replace in the template | 包含要在模板中替换的值的对象
* @returns Expanded template with variables replaced | 替换了变量的展开模板
*/
export declare function expandTemplate(template: string, variables: Record<string, string | undefined>): string;
/**
* Remove the file extension from a path. | 从路径中删除文件扩展名。
* @param filePath - Path to a file | 文件路径
* @returns Path without the extension | 没有扩展名的路径
*/
export declare function stripExt(filePath: string): string;
/**
* Normalize a file path for use in links. | 标准化用于链接的文件路径。
* @param filePath - Path to normalize | 要标准化的路径
* @param options - Normalization options | 标准化选项
* @returns Normalized path suitable for links | 适合链接的标准化路径
*/
export declare function normalizePath(filePath: string, options?: {
domain?: string;
linksExtension?: string;
cleanUrls?: boolean;
}): string;
/**
* Generate metadata for a file. | 为文件生成元数据。
* @param params - Parameters for metadata generation | 元数据生成参数
* @returns Metadata string | 元数据字符串
*/
export declare function generateMetadata(params: {
title: string;
relativePath: string;
domain?: string;
linksExtension?: string;
cleanUrls?: boolean;
}): string;