Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
123456789101112131415161718import { isMarkdownFile } from "#lib/markup/format.ts";import type { MarkupContext } from "#lib/markup/paths.ts";import { SOURCE_LIMIT, renderMarkdown } from "#lib/markup/markdown.ts";
const render = async (contents: string, ctx: MarkupContext): Promise<string | null> => { if (contents.length > SOURCE_LIMIT) return null; return `<div data-markup>${await renderMarkdown(contents, ctx)}</div>`;};
export const renderDocument = async ( filename: string, contents: string, ctx: MarkupContext): Promise<string | null> => (isMarkdownFile(filename) ? render(contents, ctx) : null);
export const renderMarkup = (contents: string, ctx: MarkupContext): Promise<string | null> => render(contents, { ...ctx, collapseCode: true });