at main 84 lines 2.5 kB view raw
1/* tslint:disable */ 2/* eslint-disable */ 3 4export class JsMathResult { 5 private constructor(); 6 free(): void; 7 [Symbol.dispose](): void; 8 success: boolean; 9 html: string; 10 get error(): string | undefined; 11 set error(value: string | null | undefined); 12} 13 14export class JsResolvedContent { 15 free(): void; 16 [Symbol.dispose](): void; 17 /** 18 * Create an empty resolved content container. 19 */ 20 constructor(); 21 /** 22 * Add pre-rendered embed HTML for an AT URI. 23 * 24 * # Arguments 25 * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 * * `html` - The pre-rendered HTML for this embed 27 */ 28 addEmbed(at_uri: string, html: string): void; 29} 30 31/** 32 * Create an empty resolved content container. 33 * 34 * Use this to pre-render embeds before calling render functions. 35 */ 36export function create_resolved_content(): JsResolvedContent; 37 38/** 39 * Initialize panic hook for better error messages in console. 40 */ 41export function init(): void; 42 43/** 44 * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 * 46 * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 * 48 * # Arguments 49 * * `text` - The plain text content 50 * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 */ 52export function render_faceted_text(text: string, facets_json: any): string; 53 54/** 55 * Render markdown to HTML. 56 * 57 * # Arguments 58 * * `markdown` - The markdown source text 59 * * `resolved_content` - Optional pre-rendered embed content 60 */ 61export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 63/** 64 * Render LaTeX math to MathML. 65 * 66 * # Arguments 67 * * `latex` - The LaTeX math expression 68 * * `display_mode` - true for display math (block), false for inline math 69 */ 70export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 72/** 73 * Render an AT Protocol record as HTML. 74 * 75 * Takes a record URI and the record data (typically fetched from an appview). 76 * Returns the rendered HTML string. 77 * 78 * # Arguments 79 * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 * * `record_json` - The record data as JSON 81 * * `fallback_author` - Optional author profile for records that don't include author info 82 * * `resolved_content` - Optional pre-rendered embed content 83 */ 84export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;