/** * Standardized comment HTML construction. * * Used by Reddit, Hacker News, GitHub, and other extractors to produce * consistent comment markup. * * Metadata format (in markdown): **author** · date · score * - date is linked if a url is provided * - score is omitted if not provided */ export interface CommentData { /** Comment author name */ author: string; /** Display date (e.g. "2025-01-15") */ date: string; /** Comment body HTML */ content: string; /** Nesting depth (0 = top-level). Omit for flat lists. */ depth?: number; /** Score text (e.g. "42 points", "25 points") */ score?: string; /** Permalink URL for the comment */ url?: string; } export interface QuotedPostData { /** Author name */ author?: string; /** Display date */ date?: string; /** Post body HTML */ content: string; /** Permalink URL */ url?: string; } /** * Site identifiers used as the wrapper class alongside `post` / `comments`. * * Typed as a union rather than `string` so that adding an extractor is a compile * error until the token is listed here. That matters because isExtractorClass() * below is what keeps these classes alive through the attribute strip. A site * that could pass any string would silently lose its wrapper class instead. */ export declare const SITE_TOKENS: readonly ["bluesky", "discourse", "github", "gmail", "hackernews", "linkedin", "lwn", "mastodon", "reddit", "threads", "twitter"]; export type SiteToken = typeof SITE_TOKENS[number]; /** * Is this class token extractor-authored markup rather than something copied off * the page? Used by the attribute strip to decide what survives. obsidian-clipper's * reader keys its per-author colors, collapse buttons, and thread tracing off * .comments / .comment / .comment-author / .comment-metadata. * * Lives here, next to the code that emits these classes, so the two cannot drift. */ export declare function isExtractorClass(token: string): boolean; /** * Build the full content HTML for a post with optional comments section. * @param site - Site identifier for wrapper class (e.g. "reddit", "hackernews", "github") * @param postContent - The main post body HTML * @param comments - Pre-built comments HTML string (from buildCommentTree) */ export declare function buildContentHtml(site: SiteToken, postContent: string, comments: string): string; /** * Build a nested comment tree from a flat list of comments with depth. * Uses
elements to represent reply hierarchy. */ export declare function buildCommentTree(comments: CommentData[]): string; /** * Build a single comment div with metadata and content. * * Metadata order: author · date · score * - date is wrapped in a link if url is provided * - score is omitted if not provided */ export declare function buildComment(comment: CommentData): string; /** * Build a quoted/reposted post blockquote. * Used by Twitter (quote tweets) and LinkedIn (reposts with commentary). */ export declare function buildQuotedPost(post: QuotedPostData): string;