This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / src / lib / markup / render.ts
838 B 24 lines
1import { isMarkdownFile } from "./format"; 2import type { MarkupContext } from "./paths"; 3 4export const renderDocument = async ( 5 filename: string, 6 contents: string, 7 ctx: MarkupContext 8): Promise<string | null> => { 9 if (!isMarkdownFile(filename)) return null; 10 const { SOURCE_LIMIT, renderMarkdown } = await import("./markdown"); 11 if (contents.length > SOURCE_LIMIT) return null; 12 return renderMarkdown(contents, ctx); 13}; 14 15// like renderDocument, but for content that is always markdown (issue and 16// comment bodies) rather than a repo file with an extension to sniff 17export const renderMarkup = async ( 18 contents: string, 19 ctx: MarkupContext 20): Promise<string | null> => { 21 const { SOURCE_LIMIT, renderMarkdown } = await import("./markdown"); 22 if (contents.length > SOURCE_LIMIT) return null; 23 return renderMarkdown(contents, ctx); 24};