astro-loader-hashnode
Version:
Astro content loader for seamlessly integrating Hashnode blog posts into your Astro website using the Content Layer API
72 lines (71 loc) • 1.72 kB
TypeScript
/**
* Extract plain text from HTML content
*/
export declare function extractTextFromHtml(html: string): string;
/**
* Generate excerpt from content
*/
export declare function generateExcerpt(content: string, maxLength?: number): string;
/**
* Calculate reading time for content
*/
export declare function calculateReadingTime(content: string, wordsPerMinute?: number): number;
/**
* Count words in content
*/
export declare function countWords(content: string): number;
/**
* Clean and normalize content
*/
export declare function normalizeContent(content: string): string;
/**
* Extract headings from HTML content
*/
export declare function extractHeadings(html: string): Array<{
level: number;
text: string;
id?: string;
}>;
/**
* Generate table of contents from headings
*/
export declare function generateTableOfContents(headings: Array<{
level: number;
text: string;
id?: string;
}>): Array<{
level: number;
title: string;
slug: string;
id: string;
parentId?: string;
}>;
/**
* Process content for display (combine multiple operations)
*/
export declare function processContent(html: string, options?: {
generateExcerpt?: boolean;
excerptLength?: number;
calculateReadingTime?: boolean;
wordsPerMinute?: number;
extractHeadings?: boolean;
generateToc?: boolean;
}): {
html: string;
text: string;
excerpt?: string;
readingTime?: number;
wordCount: number;
headings?: Array<{
level: number;
text: string;
id?: string;
}>;
tableOfContents?: Array<{
level: number;
title: string;
slug: string;
id: string;
parentId?: string;
}>;
};